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

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

$
0
0
I am using the ODataServiceSample for my scenario.

I am doing the following: Get all suppliers order by the State

foreach (var supplier in ctx.Suppliers.OrderBy(splr => splr.Address.State))
Console.WriteLine("\t{0}-{1}", supplier.ID, supplier.Name);

Generated Url is : http://kirandesktop:50231/Suppliers()?$orderby=Address/State

Exception:
-------------
HTTP/1.1 500 Internal Server Error
Content-Length: 1552
Content-Type: application/xml; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0;
Date: Wed, 05 Dec 2012 21:11:52 GMT

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code />
<m:message xml:lang="en-US">An error has occurred.</m:message>
<m:innererror>
<m:message>Object reference not set to an instance of an object.</m:message>
<m:type>System.NullReferenceException</m:type>
<m:stacktrace> at System.Web.Http.OData.ExpressionHelpers.OrderBy(IQueryable query, IEdmProperty property, OrderByDirection direction, Type type, Boolean alreadyOrdered)&#xD;
at System.Web.Http.OData.Query.OrderByQueryOption.ApplyToCore(IQueryable query)&#xD;
at System.Web.Http.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)&#xD;
at System.Web.Http.QueryableAttribute.ExecuteQuery(IEnumerable query, HttpRequestMessage request, HttpConfiguration configuration, HttpActionDescriptor actionDescriptor)&#xD;
at System.Web.Http.QueryableAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)&#xD;
at System.Web.Http.Filters.ActionFilterAttribute.&lt;&gt;c__DisplayClass2.&lt;System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync&gt;b__0(HttpResponseMessage response)&#xD;
at System.Threading.Tasks.TaskHelpersExtensions.&lt;&gt;c__DisplayClass41`2.&lt;Then&gt;b__40(Task`1 t)&#xD;
at System.Threading.Tasks.TaskHelpersExtensions.ThenImpl[TTask,TOuterResult](TTask task, Func`2 continuation, CancellationToken cancellationToken, Boolean runSynchronously)</m:stacktrace>
</m:innererror>
</m:error>

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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