New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Protocol] HTTP Status Code 500 occured when requesting non-existing entity #115

Closed
karataliu opened this Issue Jul 17, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@karataliu
Contributor

karataliu commented Jul 17, 2015

500 Exception was thrown with NRE

Request:

GET http://localhost:18384/api/TripPin/Airlines('AA') HTTP/1.1

Response

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
Server: Microsoft-IIS/8.0
OData-Version: 4.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?RDpcZ2l0XHRcUkVTVGllclx0ZXN0XE9EYXRhRW5kVG9FbmRUZXN0c1xNaWNyb3NvZnQuUmVzdGllci5XZWJBcGkuVGVzdC5TZXJ2aWNlcy5UcmlwcGluXGFwaVxUcmlwUGluXEFpcmxpbmVzKCdBQScp?=
X-Powered-By: ASP.NET
Date: Fri, 17 Jul 2015 05:19:45 GMT
Content-Length: 1946

{
  "error":{
    "code":"","message":"An error has occurred.","innererror":{
      "message":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; odata.metadata=minimal; odata.streaming=true'.","type":"System.InvalidOperationException","stacktrace":"","internalexception":{
        "message":"Cannot serialize a null 'entry'.","type":"System.Runtime.Serialization.SerializationException","stacktrace":"   at System.Web.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)\r\n   at System.Web.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)\r\n   at Microsoft.Restier.WebApi.Formatter.Serialization.ODataDomainEntityTypeSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) in d:\\git\\t\\RESTier\\src\\Microsoft.Restier.WebApi\\Formatter\\Serialization\\ODataDomainEntityTypeSerializer.cs:line 45\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
      }
    }
  }
}```

<!---
@huboard:{"custom_state":"archived"}
-->

@karataliu karataliu added the SpecBash label Jul 17, 2015

@karataliu karataliu changed the title from 500 Exception occured when requesting non-existing entity to [Protocol] HTTP Status Code 500 occured when requesting non-existing entity Jul 17, 2015

@karataliu karataliu added this to the v0.3.0-beta2 milestone Jul 30, 2015

@lewischeng-ms

This comment has been minimized.

Contributor

lewischeng-ms commented Aug 12, 2015

Fixed in #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment