我有这个例外,我在我的日志中打印导致应用程序崩溃在android,motorola设备xt1058 .
问题是我没有设备,我从发送给我日志文件的客户端获取日志 .
我不知道日志来自哪里 .
我把所有应用程序包裹在try catch中,但应用程序仍然崩溃了
09:37:10 - TaskSchedulerOnUnobservedTaskException中的错误:通过等待任务或访问其Exception属性未观察到任务的异常 . 结果,终结器线程重新抛出了未观察到的异常 .
09:37:11 - TaskSchedulerOnUnobservedTaskException出错:System.AggregateException:通过等待任务或访问其Exception属性未观察到任务的异常 . 结果,终结器线程重新抛出了未观察到的异常 . ---> System.Net.WebException:错误:System.Net.HttpWebRequest.EndGetResponse(System.IAsyncResult asyncResult)中的NameResolutionFailure [0x00064]在<552eeeb8705c4abb9eeb5ebce43b6865>:0中的System.Threading.Tasks.TaskFactory 1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func
2 [T,TResult ] endFunction,System.Action 1[T] endAction, System.Threading.Tasks.Task
1 [TResult] promise,System.Boolean requiresSynchronization)[0x00014] in <52ca43e23d764403a7855ae066156266>:0 ---从抛出异常的上一个位置开始的堆栈跟踪---在System.Runtime.ExceptionServices .ExceptionDispatchInfo.Throw()[0x0000c]在<52ca43e23d764403a7855ae066156266>:0中System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0004e]在<52ca43e23d764403a7855ae066156266>:0在System.Runtime.CompilerServices System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x0000b]在<52ca43e23d764403a7855ae066156266>:0处于System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1+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.ConfiguredTaskAwaitable
1 ConfiguredTaskAwaiter [TResult] .GetResult()[0x00000] in <52ca43e23d764403a7855ae066156266>:0 at System.Net.Http.HttpClient c__async0.MoveNext( )[0x000f3] in <21d260c0947046f0aae7990757a51ba3>:0 ---内部异常堆栈跟踪结束--- --->(内部异常#0)System.Net.WebException:错误:System.Net.HttpWebRequest.EndGetResponse上的NameResolutionFailure( System.IAsyncResult asyncResult)[0x00064]在<552eeeb8705c4abb9eeb5ebce43b6865>:0处于System.Threading.Tasks.TaskFactory 1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func
2 [T,TResult] endFunction,System.Action 1[T] endAction, System.Threading.Tasks.Task
1 [TResult] promise,System.Boolean requiresSynchronization)[0x00014] in <52ca43e23d764403a7855ae066156266>:0 ---从抛出异常的上一个位置开始的堆栈跟踪结束---在System.Runtime.Compil的<52ca43e23d764403a7855ae066156266>中的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c]处: erServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x0004e] in <52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)[0x0002e] in <52ca43e23d764403a7855ae066156266 >:System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x0000b]中的0:<52ca43e23d764403a7855ae066156266>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1+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.ConfiguredTaskAwaitable
1 ConfiguredTaskAwaiter [TResult] .GetResult() [0x00000]在<52ca43e23d764403a7855ae066156266>:System.SNet.Http.HttpClient中的0:c_async0.MoveNext()[0x000f3]在<21d260c0947046f0aae7990757a51ba3>中:0 <---
1 回答
问题出在
http call
之一导致您出现此错误,因此如果返回您期望的内容,请在Postman扩展上交叉检查您的API . 检查您的网站是否正在运行,检查网络状态,并且请习惯用try和catch来围绕这些呼叫 .用
try catch
围绕所有http调用后,将调试器放在catch
语句中,了解exception
并验证相同的URL .