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

Created Issue: Null Ref Exception from ODataEntityDeserializer.ReadEntryOrFeed [1026]

$
0
0
To repro the issue, define entity model as:

[EntitySet("Security_ArrayModel")]
[DataServiceKey("ID")]
public class Security_ArrayModel
{
public int ID { get; set; }
public List<string> StringArray { get; set; }
public List<Security_ComplexModel> ComplexArray { get; set; }
public List<Security_NestedModel> NavigationCollection { get; set; }
}

[EntitySet("Security_NestedModel")]
[DataServiceKey("ID")]
public class Security_NestedModel
{
public int ID { get; set; }
public Security_NestedModel Nest { get; set; }
}

public class Security_ComplexModel
{
public string Name { get; set; }
}

Use Security_ArrayModel as EntitySet and Post following payload to it:

POST http://hongye2:9001/Security_ArrayModel HTTP/1.1
Content-Type: application/json; odata=fullmetadata; charset=utf-8
Host: hongye2:9001
Content-Length: 104
Expect: 100-continue
Connection: Keep-Alive

{"ID":0,"StringArray":[""],"ComplexArray":[{"Name":null}],"NavigationCollection":[{"ID":0,"Nest":null}]}

It throws null ref exception with call stack:
The call stack is:

> System.Web.Http.OData.dll!System.Web.Http.OData.Formatter.Deserialization.ODataEntityDeserializer.ReadEntryOrFeed(Microsoft.Data.OData.ODataReader reader) Line 345 + 0x2f bytes C#
System.Web.Http.OData.dll!System.Web.Http.OData.Formatter.Deserialization.ODataEntityDeserializer.Read(Microsoft.Data.OData.ODataMessageReader messageReader, System.Web.Http.OData.Formatter.Deserialization.ODataDeserializerContext readContext) Line 62 + 0x8 bytes C#
System.Web.Http.OData.dll!System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.ReadFromStreamAsync.AnonymousMethod__4() Line 325 + 0x11 bytes C#
System.Web.Http.OData.dll!System.Threading.Tasks.TaskHelpers.RunSynchronously<object>(System.Func<object> func, System.Threading.CancellationToken cancellationToken) Line 243 + 0xb bytes C#
System.Web.Http.OData.dll!System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.ReadFromStreamAsync(System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger) Line 270 + 0x37 bytes C#
System.Web.Http.dll!System.Web.Http.Tracing.Tracers.MediaTypeFormatterTracer.ReadFromStreamAsync.AnonymousMethod__6() Line 204 + 0x37 bytes C#
System.Web.Http.dll!System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEndAsync<object>(System.Web.Http.Tracing.ITraceWriter traceWriter, System.Net.Http.HttpRequestMessage request, string category, System.Web.Http.Tracing.TraceLevel level, string operatorName, string operationName, System.Action<System.Web.Http.Tracing.TraceRecord> beginTrace, System.Func<System.Threading.Tasks.Task<object>> execute, System.Action<System.Web.Http.Tracing.TraceRecord,object> endTrace, System.Action<System.Web.Http.Tracing.TraceRecord> errorTrace) Line 437 + 0xb bytes C#
System.Web.Http.dll!System.Web.Http.Tracing.Tracers.MediaTypeFormatterTracer.ReadFromStreamAsync(System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger) Line 190 + 0x1a0 bytes C#
System.Net.Http.Formatting.dll!System.Net.Http.HttpContentExtensions.ReadAsAsyncCore<object>(System.Net.Http.HttpContent content, System.Type type, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Net.Http.Formatting.MediaTypeFormatter formatter) Line 151 + 0x3d bytes C#
System.Net.Http.Formatting.dll!System.Net.Http.HttpContentExtensions.ReadAsAsync<object>(System.Net.Http.HttpContent content, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger) Line 145 + 0x3f bytes C#
System.Net.Http.Formatting.dll!System.Net.Http.HttpContentExtensions.ReadAsAsync(System.Net.Http.HttpContent content, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger) Line 58 + 0x16 bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(System.Net.Http.HttpRequestMessage request, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger) Line 88 + 0x11 bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsyncCore(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.Controllers.HttpParameterDescriptor paramFromBody, System.Type type, System.Net.Http.HttpRequestMessage request, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken) Line 120 + 0x3f bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsync(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken) Line 112 + 0x1f bytes C#
System.Web.Http.OData.dll!System.Web.Http.OData.PerRequestParameterBinding.ExecuteBindingAsync(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken) Line 57 + 0x16 bytes C#


Viewing all articles
Browse latest Browse all 7215

Trending Articles



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