Skip to content

Possible interfering with HTTP Client deserializing #64

@EricAriensGit

Description

@EricAriensGit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions