runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Calling any mthod of HttpClient (i.e. PostAsync, GetAsync, etc) from within a .NET Core 3.1 WinExe Windows Forms results in error on Windows 10 version 1903.

Open grosubogdan opened this issue 6 years ago • 5 comments

Issue Title

Calling any method of HttpClient (i.e. PostAsync, GetAsync, etc) or WebClient from within a .NET Core 3.1 WinExe Windows Forms results in error on Windows 10 version 1903.

Reproduction

Your project should have these configurations:

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWindowsForms>true</UseWindowsForms>
    <Platforms>x64</Platforms>
    <LangVersion>8</LangVersion>
    <Configurations>Debug;Release</Configurations>
</PropertyGroup>

and attempt any call from HttpClient (i.e. GetAsync, PostAsync, etc)

Results in Error:

UnhandledException: System.InvalidOperationException: 'overlapped' has already been freed. at System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)

Also, be aware that this happens ONLY if you run the EXE file (i,e. MyProject.exe), because if you call directly the underlying dll (i.e. dotnet MyProject.dll) this will work.

Updating Windows 10 to version 1909 or version 2004 fixes the issue.

Seems like the response from the server is being stopped unmexepctedly and it is incomplete most likely due to an incorrect handling of async in the .

grosubogdan avatar Jul 04 '20 08:07 grosubogdan

Tagging subscribers to this area: @dotnet/ncl Notify danmosemsft if you want to be subscribed.

ghost avatar Jul 04 '20 19:07 ghost

There's not enough here to go on. It's possible your Windows, .NET, or maybe network drivers were corrupted somehow and updating Windows fixed it. If you are still able to reproduce it and can get us a memory dump, please do!

scalablecory avatar Jul 06 '20 16:07 scalablecory

It is up to you guys. We have reproduced the same bug on 3 of our 30 customers. The same fix the same issue. We have been deubgging for 2 days before we manage to figure out the cause.

grosubogdan avatar Jul 06 '20 17:07 grosubogdan

Will do the memory dump next time we encounter it.

grosubogdan avatar Jul 06 '20 22:07 grosubogdan

Not enough info, closing for now. Feel free to reopen once there is more info to make it actionable ... thanks!

karelz avatar Aug 25 '20 11:08 karelz