We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I have many crash reports in AppCenter that are related to the GetAsync() and SendAsync() methods.
GetAsync()
SendAsync()
ModernHttpClient ByteArrayListStream.ReadAsync (System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Threading.CancellationToken cancellationToken) ModernHttpClient ProgressStreamContent+ProgressStream.ReadAsync (System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Threading.CancellationToken cancellationToken) System.IO Stream.CopyToAsyncInternal (System.IO.Stream destination, System.Int32 bufferSize, System.Threading.CancellationToken cancellationToken) System.Net.Http StreamToStreamCopy+<>c.b__1_0 (System.Threading.Tasks.Task completed, System.Object innerSource) System.Threading.Tasks ContinuationTaskFromTask.InnerInvoke () System.Threading.Tasks Task.Execute () System.Net.Http HttpContent.LoadIntoBufferAsyncCore (System.Threading.Tasks.Task serializeToStreamTask, System.IO.MemoryStream tempBuffer) System.Net.Http HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts)
I have the relevant code lines inside a try/catch, but still it causes a crash (sometimes, when the connection times out i think):
try/catch
try { // ... var response = await WebApiClient.GetAsync(url); var responseJson = await response.Content.ReadAsStringAsync(); // ... } catch (Exception ex) { // ... handle it }
Where WebApiClient is a global HttpClient instance:
WebApiClient
public static HttpClient WebApiClient = new HttpClient(new NativeMessageHandler(false, new TLSConfig())) { Timeout = TimeSpan.FromSeconds(45), BaseAddress = new Uri(Misc.Constants.ApiUrlsBase.BaseUrl), });
Why would it make the app crash even tho i am using try/catch? Like I said, the error is related to timeouts:
I hope that someone may help me figure this out, thank you.
The text was updated successfully, but these errors were encountered:
The max timeout you can set is 30 seconds (by platform specific limitations). Can you provide a reproduction demo?
Sorry, something went wrong.
After further testing i was able to simulate poor internet connection and reproduce this exception. I think it's just related to weak internet.
I think the implementation of #72 can help with this.
No branches or pull requests
Hello,
I have many crash reports in AppCenter that are related to the
GetAsync()
andSendAsync()
methods.I have the relevant code lines inside a
try/catch
, but still it causes a crash (sometimes, when the connection times out i think):Where
WebApiClient
is a global HttpClient instance:Why would it make the app crash even tho i am using
try/catch
? Like I said, the error is related to timeouts:I hope that someone may help me figure this out, thank you.
The text was updated successfully, but these errors were encountered: