-
Notifications
You must be signed in to change notification settings - Fork 548
Closed
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fixnetworkingIf an issue or pull request is related to networkingIf an issue or pull request is related to networking
Milestone
Description
I am seeing a crash in one of my app when doing web requests and using an NSUrlSessionHandler.
var httpClient = new HttpClient(new NSUrlSessionHandler())
I have noticed this crash being reported for months already, but with the last update I have added a button to the apps UI that allows users to cancel web requests (using CancellationToken) and it appears like as if this change has increased the occurence of the exception even more. I have all my web requests in a try-catch clause, however this exception crashes my app nevertheless.
ObjectDisposed_StreamClosed (System.ObjectDisposedException)
at System.ThrowHelper.ThrowObjectDisposedException_StreamClosed(String) + 0x3c
at System.IO.MemoryStream.Read(Byte[], Int32, Int32) + 0x124
at System.Net.Http.MultipartContent.ContentReadStream.Read(Byte[], Int32, Int32) + 0x78
at System.Net.Http.NSUrlSessionHandler.WrappedNSInputStream.Read(IntPtr buffer, UIntPtr len) + 0x58
at MyApp!<BaseAddress>+0x7082f8
According to Sentry, the crash happens in the com.apple.NSURLConnectionLoader thread (and that's also likely the reason I am unable to catch the exception)
Environment
.NET 8, NativeAot-compiled
iOS 17.3.1
Metadata
Metadata
Assignees
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fixnetworkingIf an issue or pull request is related to networkingIf an issue or pull request is related to networking