xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
542 stars 349 forks source link

System.Net.WebException: Error: NameResolutionFailure #187

Open JakubHolovsky opened 7 years ago

JakubHolovsky commented 7 years ago

Xamarin.Auth Issue

Version

Steps to reproduce

  1. Can't reproduce (it's coming from our crash analytics), one off bug but might lead you to potentially fixing the issue.

Android: 5.1.1 Android Build: LMY48B.J500GXXU1AOL1 Manufacturer: samsung Model: SM-J500G Thread: Thread-2666-2666 CrashReporter Key: A6142E57-3598-E073-FC61-BF4DDEFDCB44BD56B087 Start Date: Mon Jun 05 23:56:02 GMT+08:00 2017 Date: Tue Jun 06 00:04:28 GMT+08:00 2017 Format: Xamarin

Xamarin caused by: android.runtime.JavaProxyThrowable: System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.AggregateException: One or more errors occurred. ---> System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in :0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in :0 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in :0 at System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <a83cd6d69e484f55bdb92ebf1dda2881>:0 at System.Threading.Tasks.Task1[TResult].get_Result () [0x0000f] in :0 at Xamarin.Auth.OAuth1Authenticator.m__0 (System.Threading.Tasks.Task1[TResult] respTask) [0x00000] in <bae572ba45754aac977da65c58a52c3b>:0 at System.Threading.Tasks.ContinuationResultTaskFromResultTask2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in :0 at System.Threading.Tasks.Task.Execute () [0x00010] in :0 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in :0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in :0 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in :0 at System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <a83cd6d69e484f55bdb92ebf1dda2881>:0 at System.Threading.Tasks.Task1[TResult].get_Result () [0x0000f] in :0 at Xamarin.Auth.OAuth1Authenticator.m__0 (System.Threading.Tasks.Task1[TResult] respTask) [0x00000] in <bae572ba45754aac977da65c58a52c3b>:0 at System.Threading.Tasks.ContinuationResultTaskFromResultTask2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in :0 at System.Threading.Tasks.Task.Execute () [0x00010] in :0 ---> (Inner Exception #0) System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in :0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in :0 <--- <---

Platform:

Expected behaviour

The app should not crash if "resolution failure" happens.

VS bug #733078

moljac commented 7 years ago

This is now design problem.

OK. I might put it in Xamarin.Auth, but how do you want me to inform user that they have DNS problems (possible network problems).

Everything in Xamarin.Auth starts (and finishes) from ctor. I would put ctor in try/catch and then decide to log or show to user.

But thanks for investigating and reporting

JakubHolovsky commented 7 years ago

@moljac shouldn't this trigger error event? I can put the try catch to my app but just wondering what the best approach is here.

jposes22 commented 6 years ago

The same on iOS not only Android.

moljac commented 5 years ago

Xamarin.Auth does not handle networking issues/interruptions during OAuth flow.

Due to lack of info and difficulty of reproducing triaging it as "Low Priority"