Hello, again, I've created a really simple example that doesn't do anything unusual (like custom automapping conventions) that exhibits this problem. These URLs work, at least in the sense that they don't crash, though I haven't inserted any data to see that the right results come back:
http://localhost:48576/OData/Three http://localhost:48576/OData/Three?$expand=Two http://localhost:48576/OData/Three(0) http://localhost:48576/OData/Three(0)/Fours http://localhost:48576/OData/Three%280%29/Fours?$expand=Three These fail with the same exception at the same place, though I didn't verify the entire stack trace: http://localhost:48576/OData/Three?$expand=Two($expand=One) http://localhost:48576/OData/Three(0)/Fours?$expand=Three($expand=Two) Thanks, Don On Thursday, September 3, 2015 at 2:43:47 PM UTC-4, Don Lavelle wrote: > > Hello, > > I'm using NH 4.0.4.4000 to serve data through OData > using Microsoft.AspNet.OData 5.7.0. When I try to use $expand at multiple > levels, e.g., > http://server/WebApp/OData/Profile(2848)/MentorshipsAsMentor?$expand=Mentee($expand=InstitutionalAccount), > > I keep getting an NullReferenceException in NHibernate at: > > at > NHibernate.Linq.Visitors.ExpressionKeyVisitor.VisitConstantExpression(ConstantExpression > > expression) > at > NHibernate.Linq.Visitors.ExpressionKeyVisitor.VisitBinaryExpression(BinaryExpression > > expression) > at > NHibernate.Linq.Visitors.ExpressionKeyVisitor.VisitConditionalExpression(ConditionalExpression > > expression) > at > NHibernate.Linq.Visitors.ExpressionKeyVisitor.VisitMemberExpression(MemberExpression > > expression) > at > NHibernate.Linq.Visitors.SelectJoinDetector.VisitMemberExpression(MemberExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitConditionalExpression(ConditionalExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberAssignment(MemberAssignment > > memberAssigment) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitList[T](ReadOnlyCollection`1 > list, Func`2 visitMethod) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberInitExpression(MemberInitExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberAssignment(MemberAssignment > > memberAssigment) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitList[T](ReadOnlyCollection`1 > list, Func`2 visitMethod) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberInitExpression(MemberInitExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberAssignment(MemberAssignment > > memberAssigment) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitList[T](ReadOnlyCollection`1 > list, Func`2 visitMethod) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberInitExpression(MemberInitExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberAssignment(MemberAssignment > > memberAssigment) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitList[T](ReadOnlyCollection`1 > list, Func`2 visitMethod) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberInitExpression(MemberInitExpression > > expression) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberAssignment(MemberAssignment > > memberAssigment) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitList[T](ReadOnlyCollection`1 > list, Func`2 visitMethod) > at > Remotion.Linq.Parsing.ExpressionTreeVisitor.VisitMemberInitExpression(MemberInitExpression > > expression) > at Remotion.Linq.Clauses.SelectClause.TransformExpressions(Func`2 > transformation) > at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel > queryModel) > at > NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel > queryModel, VisitorParameters parameters, Boolean root) > at > NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor > sessionFactory, Boolean filter) > at > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression > > queryExpression, String collectionRole, Boolean shallow, IDictionary`2 > filters, ISessionFactoryImplementor factory) > at NHibernate.Engine.Query.QueryExpressionPlan..ctor(IQueryExpression > queryExpression, Boolean shallow, IDictionary`2 enabledFilters, > ISessionFactoryImplementor factory) > at > NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression > queryExpression, Boolean shallow, IDictionary`2 enabledFilters) > at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression > queryExpression, Boolean shallow) > at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression > queryExpression) > at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) > at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression > expression) > at Remotion.Linq.QueryableBase`1.GetEnumerator() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Web.OData.Query.TruncatedCollection`1..ctor(IQueryable`1 > source, Int32 pageSize) > at > System.Web.OData.Query.ODataQueryOptions.LimitResults[T](IQueryable`1 > queryable, Int32 limit, Boolean& resultsLimited) > > I downloaded the NH source and built it so I can do a little debugging, > but nothing obvious struck me that I was doing wrong. The thing that is > null is _constantToParameterMap in > NHibernate.Linq.Visitors.ExpressionKeyVisitor in that call. If I copy the > entire object tree to new objects that don't come out of NH, this doesn't > happen. > > Any ideas? > > Thanks, > > Don > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
NhODataTest.tar.gz
Description: Binary data
