Skip to content

Show inner-most exception? #2292

Open
Open

Description

@timcassell

Typically in .Net, calling Exception.ToString returns the exceptions from inner-most to outer-most. I was surprised to see that Sentry does the opposite.

I am using Sentry in Unity along with ProtoPromise async library, and when ProtoPromise encounters an uncaught exception, it wraps it in another exception. This doesn't play well with Sentry, because all our exceptions display exactly the same (until we dig into the details). Is there a setting where I can invert this to display more like Unity's cloud diagnostics?

Image

[Edit] Maybe it's related to getsentry/sentry-dotnet#4388? I'm not sure.

Activity

  1. linear commented on Aug 15, 2025

    @linear
  2. getsantry commented on Aug 15, 2025

    @getsantry

    Assigning to @getsentry/support for routing ⏲️

  3. moved this to Waiting for: Support in GitHub Issues with 👀 3on Aug 15, 2025
  4. transferred this issue fromgetsentry/sentryon Aug 15, 2025
  5. moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3on Aug 15, 2025
  6. linear commented on Aug 15, 2025

    @linear
  7. bitsandfoxes commented on Aug 18, 2025

    @bitsandfoxes
    Contributor

    Hey @timcassell, sorry to see you run into issues. Looking into it it seems like we're "hardcoding" this behaviour in the MainExceptionProcessor here. Afaik we're going this to create a oldest->newest behaviour.
    I'll have to see if we can make this behaviour optional and what side-effects this introduces.

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Aug 18, 2025
  9. timcassell commented on Aug 23, 2025

    @timcassell
    Author

    AFAICT that code does what I'd expect. It walks the inner exceptions then reverses them, so the inner-most is first in the list. So the cause must be somewhere else.

  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Aug 23, 2025
  11. bitsandfoxes commented on Aug 26, 2025

    @bitsandfoxes
    Contributor

    Unfortunately, I don't think this is going to be a straight forward fix that is happening anytime soon.
    But what you can do to unblock yourself is implementing a BeforeSend and inverse the offending exceptions yourself.
    Something like

    options.SetBeforeSend((sentryEvent, _) =>
    {
        var sentryExceptions = sentryEvent.SentryExceptions;
        if (sentryExceptions.Any() && sentryExceptions.First().Type == "Proto.Promises.Internal...")
        {
            sentryEvent.SentryExceptions = sentryExceptions.Reverse();
        }
    
        return sentryEvent;
    });
    
  12. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Aug 26, 2025
  13. bruno-garcia commented on Aug 26, 2025

    @bruno-garcia
    Member

    @bitsandfoxes can you expand why it's hard to fix this and why there can't be a fix anytime soon? I didn't get that from your message

  14. added
    Errorsissues relates to the error reporting product
    on Mar 25, 2026
  15. timcassell commented on Mar 26, 2026

    @timcassell
    Author

    I've been using this workaround:

    options.SetBeforeSend((sentryEvent, _) =>
    {
        sentryEvent.SentryExceptions = sentryEvent.SentryExceptions?.Reverse();
        return sentryEvent;
    });

    It was working for a while, but for the past few months I've been seeing once again the same issue. So I thought maybe it was fixed. I tried removing the workaround, but it doesn't make a difference anymore. I see the same thing in the feed either way.

  16. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Mar 26, 2026
  17. bitsandfoxes commented on Mar 30, 2026

    @bitsandfoxes
    Contributor

    It was working for a while, but for the past few months I've been seeing once again the same issue.

    As in, you reversing it is reversing it? I'm not aware of any changes in that regard in the Sentry SDK for .NET, @Flash0ver are you?

  18. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Errorsissues relates to the error reporting productImprovementimprovement for existing featuresState: Needs DiscussionUnityplatform label

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions