-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] HttpClient.PostAsync() doesn't work on iOS #13920
Comments
This looks like a variation of this bug: dotnet/runtime#61153, which was recently fixed and will be included in the next service release. It should work if you disable hot restart in your project. |
As I found on the Internet, this is an old problem. It has already appeared earlier from time to time. Maybe it depends on iOS device, maybe it depends on iOS version, maybe on Mono version, maybe on Xamarin.iOS version, maybe on Xamarin.Forms version, I don't know. |
I also found a workaround. All you have to do is use the HttpClientHandler.
And it helps! All works fine, as expected! But the question is: why it doesn't work without the HttpClientHandler?! |
The default handler is a very different implementation, and likely doesn't hit the same problem. In any case, I'm glad you were able to find a workaround until the fix is released, so I'll close this. |
I create a Xamarin.Forms app and run it on Windows (UWP), Android, and iOS.
I debug my app on devices from Visual Studio on Windows (using the Hot Restart for iOS).
Now I found the issue with a calling of the HttpClient.PostAsync() method on iOS. But the HttpClient.GetAsync() method works fine as expected.
And HttpClient.PostAsync() method also works as expected on UWP and Android.
Steps to Reproduce
Create any Xamarin.Forms or Xamarin.iOS app. Use the following code:
Expected Behavior
The PostAsync() method should return a response.
Actual Behavior
The PostAsync() method doesn't return a response and doesn't return control to the app at all. The app is hanged.
At the same time, I see the exception in the Visual Studio output log:
Environment
Windows Version 21H2 (OS Build 19044.1415)
Xamarin.Forms 5.0.0.2083
iPhone 7 Plus device with iOS version 15.2.1
.
The text was updated successfully, but these errors were encountered: