0
votes

I have this exception that i printed in my log that cause the app to crash in android, motorola device xt1058.

The problem is that I don't have the device and I got the log from the client who sent me the log file.

I have no idea where the logs comes from.

I have all the app wrapped in try catch but still the app crashed

09:37:10 - Error in TaskSchedulerOnUnobservedTaskException: 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.

09:37:11 - Error in TaskSchedulerOnUnobservedTaskException: 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.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <552eeeb8705c4abb9eeb5ebce43b6865>: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) [0x00014] in <52ca43e23d764403a7855ae066156266>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0 at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0041e] in <21d260c0947046f0aae7990757a51ba3>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0 at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000f3] in <21d260c0947046f0aae7990757a51ba3>:0 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <552eeeb8705c4abb9eeb5ebce43b6865>: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) [0x00014] in <52ca43e23d764403a7855ae066156266>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0 at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0041e] in <21d260c0947046f0aae7990757a51ba3>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0 at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000f3] in <21d260c0947046f0aae7990757a51ba3>:0 <---

1
was that name resolution failure? when it crashed?Akshay Kulkarni
Unfortunately this is the only details I have - I don't know exactly when it crashes since I have several tasks and services that are using the system.net.httpasaf
await your async calls, that will at least give you a meaningful exception.Will Decker

1 Answers

0
votes

the problem is with one of the http call which leads you to this error, so cross check your API on Postman extension if it returns what you expect. check your website is running, check network status and please have a habit of surrounding these calls with try and catch.

Once you surround all your http calls with try catch put your debugger in the catch statement understand the exception and verify the same URL.