Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Null ref exception when trying to query(orderby) on a complex type property's member. [682]

$
0
0
I am using the ODataServiceSample for my scenario.<br /><br />I am doing the following: Get all suppliers order by the State<br /><br />foreach (var supplier in ctx.Suppliers.OrderBy(splr => splr.Address.State))<br /> Console.WriteLine("\t{0}-{1}", supplier.ID, supplier.Name);<br /><br />Generated Url is : http://kirandesktop:50231/Suppliers()?$orderby=Address/State<br /><br />Exception:<br />-------------<br />HTTP/1.1 500 Internal Server Error<br />Content-Length: 1552<br />Content-Type: application/xml; charset=utf-8<br />Server: Microsoft-HTTPAPI/2.0<br />DataServiceVersion: 3.0;<br />Date: Wed, 05 Dec 2012 21:11:52 GMT<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><br /> <m:code /><br /> <m:message xml:lang="en-US">An error has occurred.</m:message><br /> <m:innererror><br /> <m:message>Object reference not set to an instance of an object.</m:message><br /> <m:type>System.NullReferenceException</m:type><br /> <m:stacktrace> at System.Web.Http.OData.ExpressionHelpers.OrderBy(IQueryable query, IEdmProperty property, OrderByDirection direction, Type type, Boolean alreadyOrdered)<br /><br /> at System.Web.Http.OData.Query.OrderByQueryOption.ApplyToCore(IQueryable query)<br /><br /> at System.Web.Http.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)<br /><br /> at System.Web.Http.QueryableAttribute.ExecuteQuery(IEnumerable query, HttpRequestMessage request, HttpConfiguration configuration, HttpActionDescriptor actionDescriptor)<br /><br /> at System.Web.Http.QueryableAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)<br /><br /> at System.Web.Http.Filters.ActionFilterAttribute.<>c__DisplayClass2.<System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync>b__0(HttpResponseMessage response)<br /><br /> at System.Threading.Tasks.TaskHelpersExtensions.<>c__DisplayClass41`2.<Then>b__40(Task`1 t)<br /><br /> at System.Threading.Tasks.TaskHelpersExtensions.ThenImpl[TTask,TOuterResult](TTask task, Func`2 continuation, CancellationToken cancellationToken, Boolean runSynchronously)</m:stacktrace><br /> </m:innererror><br /></m:error>
Comments: we don't support nested properties. we should throw a better exception than NRE in this case though.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>