You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also tested on .NET 6 and .NET Framework 4.8 with the same results.
Known Workarounds
Using Task.Run or loading HttpClient.DefaultProxy are the only options to get rid of the blocking.
Configuration
.NET 9.0.100
Other information
Debugging reveals that the blocking operation happens in HttpConnectionPoolManager, when HttpClient.DefaultProxy is requested.
Retrieving HttpClient.DefaultProxy eventually leads to WinHttpGetIEProxyConfigForCurrentUser where the majority of the blocking comes from (even if no system-wide proxy is configured). This operation is executed non-asynchronously, hence it blocks the construction of the Task.
The text was updated successfully, but these errors were encountered:
eventually leads to WinHttpGetIEProxyConfigForCurrentUser
Do you see this on multiple machines, or does it only reproduce on one?
Do you mind also trying the workaround mentioned in #30025 (comment) to see if that helps?
6 seconds is long, so I could see this impacting calling code (e.g. UI that becomes unresponsive for several seconds at startup).
Given it's only a problem during the first access to the property, I think it'd be fine to hide it behind Task.Run.
Description
Task
-returning methods onHttpClient
are blocking for up to a few seconds when called for the first time, despite their documentation:Reproduction Steps
Expected behavior
Waiting for result...
should be displayed shortly afterSending request...
when the asynchronous operation starts.Actual behavior
Regression?
Also tested on .NET 6 and .NET Framework 4.8 with the same results.
Known Workarounds
Using
Task.Run
or loadingHttpClient.DefaultProxy
are the only options to get rid of the blocking.Configuration
.NET 9.0.100
Other information
Debugging reveals that the blocking operation happens in HttpConnectionPoolManager, when
HttpClient.DefaultProxy
is requested.Retrieving
HttpClient.DefaultProxy
eventually leads toWinHttpGetIEProxyConfigForCurrentUser
where the majority of the blocking comes from (even if no system-wide proxy is configured). This operation is executed non-asynchronously, hence it blocks the construction of theTask
.The text was updated successfully, but these errors were encountered: