c# - 如何修复 "' System.AggregateException' 出现在 mscorlib.dll 中”

标签 c# .net exception aggregateexception

我在调试时收到未处理的异常,程序停止执行。调试器没有向我显示该行,所以我不知道要修复什么。

An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll

Additional information: 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.

Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away. System.Threading.Tasks.TaskExceptionHolder

我该如何解决这个问题?

我还找到了this question这非常相似。

最佳答案

如消息所述,您有一个任务引发了未处理的异常。

打开 Break on All Exceptions (Debug, Exceptions) 并重新运行程序。
这将向您显示最初抛出异常时的原始异常。


(附加评论):在 VS2015(或更高版本)中。选择 Debug > Options > Debugging > General 并取消选择“Enable Just My Code”选项。

关于c# - 如何修复 "' System.AggregateException' 出现在 mscorlib.dll 中”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11122092/

相关文章:

c# - SoapException 服务器无法处理 MVC 站点中 ASMX web 服务的请求

c# - 了解 Parallel.Invoke,线程的创建和重用

c# - Sharepoint 访问请求 "Permission"代码

c# - 在 DLL 中编译类并在 C# 中的另一个项目中引用它

c# - 带接口(interface)的对象创建

c# - async/await WhenAll 在两个具有相同返回类型的方法上

c# - 如何撤消未更改文件的未决更改?

c# - 如果 ExceptionHandler 捕获异常,则不会调用 DelegatingHandler

c# - 如何捕获另一个程序的异常(用于日志记录)?

c# - 为什么 .NET/C# 不针对尾调用递归进行优化?