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
Android app sometimes crashing with Java.Net.SocketException #153
Comments
Hm, looks like we're not marshaling an exception properly |
Same seems to happen with a "Java.Net.ConnectException". Is there anything I can do to help you? |
Line numbers in this call stack would help :) |
I can reproduce this consistently on 5.0, I can't seem to make it happen on earlier versions. ModernHttpClient is 2.4.2. I'm not sure this is an issue though, for me its the result of cancelling a task that is a request. |
|
@dbeattie71 Can you get line numbers for the original call stack? |
Sorry I couldn't provide you with the linenumbers.
|
Still getting sometimes exceptions in my dashboard which aren't getting caught by my try/catch
|
I was hoping to transition to ModernHttpClient to leverage its performance but also to address a problem we're seeing with the .net HttpClient. However, when testing we frequently ran into this issue, and having the app crash due to a network error is obviously a non-starter. I will try to find time to capture a stack trace and add it to this bug, if that helps. |
Hi, guys Just to throw in the information I have: We wrote an application and were having similar problems: some users reported that requests didn't finish - but just on some devices ... same as you guys here. Now I got hands on one of those mobile-phones. It was a I wonder if it has something to do with this one ... https://stackoverflow.com/questions/30312571/socketexception-socket-closed-only-with-motorola-moto-g-2013 - maybe also a false positive. If you need some further testing, I am willing to ask the guy, owning that phone, for a visit to do further testing. |
To prevent Xamarin.Android from crashing (and allow me to catch network errors) I needed to add this to my [Application]
public class MyApplication : Application
{
public MyApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { }
public override void OnCreate()
{
base.OnCreate();
AndroidEnvironment.UnhandledExceptionRaiser += OnAndroidEnvironmentUnhandledException;
}
protected override void Dispose(bool disposing)
{
AndroidEnvironment.UnhandledExceptionRaiser -= OnAndroidEnvironmentUnhandledException;
base.Dispose(disposing);
}
private void OnAndroidEnvironmentUnhandledException(object sender, RaiseThrowableEventArgs e)
{
// LOG
if (e.Exception is Java.IO.IOException) e.Handled = true;
}
} Also see #195, which is related. |
@paulcbetts I managed to get some line numbers on the call stack (no line numbers on system .dlls for some reason) for the issue @dbeattie71 was reporting involving task cancellation. I'm attaching the file I collected. Let me know if I can help in any other way. |
This is a stack trace from the Galaxy S5 Emulator (XAP). Similar exception. Reproducible every time I cancel a download.
|
Running into this issue, but looks like this library is no longer in active development. |
Sometimes my android app using ModernHttpClient crashes.
I can't reproduce this problem, but it currently appears 1-2 times a day when using the app.
I'm on a Nexus 5 with Android 5.1.
Even if I try/catch the whole HttpClient.SendAsync with a general "Exception" handler, the app still completly crashes.
Do you have any idea?
This is the full stacktrace reported via hockeyapp:
The text was updated successfully, but these errors were encountered: