-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.NET 6 / MAUI RC 1
Description
From @RedChops here: dotnet/maui#6460 (comment)
I can't get any iteration of HttpClient working (managed or native). Native crashes the app immediately on launch, Managed acts incredibly strangely. It appears to crash from a NullReferenceException, but sometimes it crashes silently, causing all code that would otherwise use the result of SendAsync to be skipped.
For example:
- var result = await client.SendAsync(...);
- var content = await result.Content.ReadAsStringAsync()
- [something else]
If I set a breakpoint on line 2, that breakpoint will get skipped and code will continue to execute on line 3, causing both result and content to be null.
I spent a large part of the day uninstalling all VS versions, clearing out the dotnet folder of all SDKs, reinstalling everything, etc, so everything should be clean and at the latest version.
Steps to Reproduce
I've attached here a small reproduction project.
Did you find any workaround?
No
Relevant log output
The first is AndroidClientHandler.adb.txt which is the output from using the Android HttpClient.
The second is HttpClientHandler.adb.txt. This of course includes the output from the AndroidClientHandler log since it's the same emulator boot.
Both of these logs were generated off that sample project which I created fresh specifically for this bug, so there shouldn't be anything else weird going on there. They also both were run in Debug mode with <RunAOTCompilation>False</RunAOTCompilation> set in the csproj.