Skip to content
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

Possible interfering with HTTP Client deserializing #64

Open
EricAriensGit opened this issue Jan 3, 2019 · 1 comment
Open

Possible interfering with HTTP Client deserializing #64

EricAriensGit opened this issue Jan 3, 2019 · 1 comment

Comments

@EricAriensGit
Copy link

After installing LINQBridge one of our project was throwing runtime errors. We debugged and found the problem in serializing/deserializing data.
The error was in the BaseHTTPClient
After replacing
`
protected static T ReadResponse(HttpResponseMessage response)
{
if (response.IsSuccessStatusCode)
{
var task = response.Content.ReadAsAsync();
return task.Result;
}

        response.EnsureSuccessStatusCodeWithContent();
        return default(T);
    }

`

with this
`
protected static T ReadResponse(HttpResponseMessage response)
{
List m = new List();
m.Add(new JsonMediaTypeFormatter
{
SerializerSettings = new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.All
}
});

        if (response.IsSuccessStatusCode)
        {
            var task = response.Content.ReadAsAsync<T>(m);

            return task.Result;
        }

        response.EnsureSuccessStatusCodeWithContent();
        return default(T);
    }

`

The problem was solved

@codingadventures
Copy link
Owner

codingadventures commented Jan 3, 2019

Hi Eric,

Thanks for reporting this issue. The installation itself shouldn't generate issues, however I guess you bridged the entire solution, is that correct?

I would need more info to replicate this bug, could you tell me the definition of type T that is generating the runtime error? Also, what exception are you seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants