Closed benpocalypse closed 11 months ago
Looking at pr and the problem, seems like a pretty common issue with blocking the await
when running on UI thread. You should consider running the code on a background thread and using Dispatcher.UIThread
if you need to change UI for some reason from that thread. Also consider using .ConfigureAwait(false)
that would enable resume from another thread, but that would also necessitate the use of Dispatcher.UIThread
after the await
block as it could run on a different thread after it was resumed.
First - thanks for making this library, it's really awesome.
Description When using the Mastonet library in an Avalonia project, for some reason the
AuthenticationClient.CreatApp()
method hangs and never returns (even past the default 100 secondHttpClient
timeout.)I traced the problem down to the
Post()
method and was able to change it slightly so that it runs correctly. I'm not an expert inHttpClient
-fu, so I made a fork and will open a PR shortly with my suggested fix - but feel free to tell me my approach isn't correct.This behavior doesn't happen when used outside of a project referencing Avalonia. Very odd.
EDIT: Pull request is here: https://github.com/glacasa/Mastonet/pull/105