Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Errors when Serializing to JSON #4160

@capesean

Description

@capesean

I am hitting an error that I can't quite pinpoint. If you can tell me how to debug it better I'll gladly provide the details. This was working fine with EF7 before the change to EntityFrameworkCore 1.0, but now I'm getting these two types of errors. I don't think it's an EF issue because the data gets returned from the database fine, it seems to error when it gets serialized in the WebApi. Although maybe it's an issue with Json.Net.

I have an EF model of clients that have projects. A project has a Project Manager, a Project Type, (etc) as related entities.

When I query the API endpoint to list the projects, I run this code:

return Ok(
    DbContext.Projects
        .Include(p => p.Client)
        .Include(p => p.ProjectManager)
        .Include(p => p.ProjectType)
    );

I get the error:

HTTP Error 502.3 - Bad Gateway
The specified CGI application encountered an error and the server terminated the process.

Most likely causes:
The CGI application did not return a valid set of HTTP errors.
A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.

If I remove the line .Include(p => p.Client) then I get a different issue: the json gets truncated after about 259 projects. If I put a .Take(258) in there, then it works fine.

It looks like 2 different issues - the CGI error and the truncating error. As mentioned, this worked a few days ago before I upgraded to AspNetCore and EntityFrameworkCore.

I'm not sure how to get more error information out but if direct me I'll do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions