javapowered javapowered - 2 months ago 23
C# Question

how to fix "'System.AggregateException' occurred in mscorlib.dll"

I receive such problem in debugger and program stops executing. Debugger doesn't show me the line so I don't know what to fix.


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 '' as it is not
available at this instruction pointer, possibly because it has been
optimized away. System.Threading.Tasks.TaskExceptionHolder


How to troubleshoot my problem?

I also found this question which is pretty similar Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away

Answer Source

As the message says, you have a task which threw an unhandled exception.

Turn on Break on All Exceptions (Debug, Exceptions) and rerun the program.
This will show you the original exception when it was thrown in the first place.