Most exceptions are logged as System.AggregateException
See original GitHub issueRunning with .NET 4.7.2, with heavy use of Parallel.ForEach
. After moving to sentry-dotnet from Raven, most of our exceptions now show up in Sentry dashboard as “System.AggregateException: One or more errors occurred.”. Raven used to unpack those if there was just a single inner exception, which made the dashboard a lot more “glanceable”.
Now I understand this might be an explicit design choice not to unpack them: in this case, could you please provide a code sample how to preprocess them in the client code (I’m guessing somewhere with filters?)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:9 (9 by maintainers)
Top Results From Across the Web
c# - How to fix "'System.AggregateException' occurred in ...
Turn on Break on All Exceptions (Debug, Exceptions) and rerun the program. ... any exceptions (and logging) that are executed within a task....
Read more >Debugging System.AggregateException - even in async code
As the name implies, AggregateException is used to batch one or more exceptions together in a single exception. In this post, I'll show...
Read more >AggregateException.Flatten Method (System)
This method recursively flattens all instances of AggregateException exceptions that are inner exceptions of the current AggregateException instance. The inner ...
Read more >One or more errors occurred. Stack Trace: Caught exception
Stack Trace: Caught exception: System.AggregateException Message: One or more errors occurred. at System.Threading.Tasks.Task.
Read more >OCR Engine throws: RemoteException wrapping System. ...
When using an OCR engine activity, the following exception is thrown: RemoteException wrapping System.Exception: An unexpected error has ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Although some of .NET’s API will wrap exceptions in
AggregateException
, simply because more than one exception could have happened at that point (i.e TPL), it’s also a valid scenario for a user to throw it’s own instance, with a meaningful message and location (stacktrace). Also, acatch
block in between thethrow
and Sentry capturing it could have added useful stuff intoData
. That would also be lost if we simply dropped theAggregateException
With that in mind, it was a design idea to not throw this information away automatically but perhaps shortsighted as for many usages of the TPL like yours this is likely noise only.
It’s a fair request to add the possibility to drop
AggregateException
altogether by default (on 2.0.0 which is breaking) although that will affect event grouping and could be a showstopper to many, I’m afraid.Another option is to add an opt-in:
UnwrapOnlyAggregateException
or something with a much better name.Code doing all that is here:
https://github.com/getsentry/sentry-dotnet/blob/c77736679b500f7cc7ad760d0274f2f703d7b34c/src/Sentry/Internal/MainExceptionProcessor.cs#L65-L102
In case you or someone else in the community like to help with a PR proposing a change. I’d be happy to review and discuss it further.
Until then:
The work around you’re looking for would look like this:
To summarize, we would like to add a client-side option to the SDK that will filter out aggregate exceptions, but would still keep all the inner exceptions.