LINQBridgeVs icon indicating copy to clipboard operation
LINQBridgeVs copied to clipboard

Possible interfering with HTTP Client deserializing

Open EricAriensGit opened this issue 6 years ago • 1 comments

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<T>(HttpResponseMessage response) { if (response.IsSuccessStatusCode) { var task = response.Content.ReadAsAsync<T>(); return task.Result; }

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

`

with this ` protected static T ReadResponse<T>(HttpResponseMessage response) { List<MediaTypeFormatter> m = new List<MediaTypeFormatter>(); 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

EricAriensGit avatar Jan 03 '19 11:01 EricAriensGit

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?

codingadventures avatar Jan 03 '19 11:01 codingadventures