I’ve got a winforms client that is using the HttpJsonClient to make .Get calls to a web service. The client works fine using SS v5.7 and has been for years. Working on the next version and I’m using SS 5.11. Client code is basically same, but UI is deadlocking at the JsonHttpclient Get call response.
Did some googling and found this article on the httpClient: https://josef.codes/you-are-probably-still-using-httpclient-wrong-and-it-is-destabilizing-your-software/. Version 0 of that article says that you shouldn’t use sync calls with HTTP client, rather async all the way.
It looks like the synchronous calls in JsonHttpClient are using Task.Result.
internal static class InternalExtensions
{
public static T GetSyncResponse<T>(this Task<T> task)
{
try
{
return task.Result;
}
catch (Exception ex)
{
throw ex.UnwrapIfSingleException();
}
}
I’ve tried a few things to get around this while still using that client, but I still end up deadlocked. Just curious if anyone else has seen this. It looks like I just need to change to the JsonServiceClient since it uses the older web client for synchronous calls.
Thanks,
Brian