Open pebo opened 1 year ago
What exactly do you mean by this?
Response: None
What is the status code and payload of the response?
The server starts writing the status code (200), response headers and the first part of the body and then it stops and closes the connection. Curl output:
* Trying 127.0.0.1:8080... * Connected to localhost (127.0.0.1) port 8080 (#0) GET /api/foos?$filter=status%20gt%20'90' HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.79.1 Accept: */* * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8 < Date: Mon, 26 Sep 2022 15:24:42 GMT < Transfer-Encoding: chunked < OData-Version: 4.0 < * transfer closed with outstanding read data remaining * Closing connection 0 curl: (18) transfer closed with outstanding read data remaining {"@odata.context":"http://localhost:8080/api/$metadata#foos","value":[
So it seems like the problem is caused by Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor
failing after the server has started to write the response. Is there a workaround for this, e.g. to translate the LINQ expression before starting the response streaming?
Assemblies affected
Describe the bug When getting errors from Entity Framework there's no response to the client due to
Do I need to setup special error handling for OData and is it possible to return some kind of 500 / Internal Error response for this?
Reproduce steps
http://localhost:8080/api/entity?filter=id gt '2452'
Data Model
EDM (CSDL) Model
Request/Response Request:
http://localhost:8080/api/entity?filter=id gt '2452'
The greater than operator isn't allowed for strings so this will throw an error in entity framework.Response: None
Expected behavior An Odata error response is returned (http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#_Toc38457793)
Screenshots
Additional context ODataController:
Stack trace: