Ben.Demystifier icon indicating copy to clipboard operation
Ben.Demystifier copied to clipboard

Expose cleaned up Exception

Open btecu opened this issue 4 years ago • 3 comments

Right now when an exception is .Demystify() it exposes a cleaned up stack trace. The issue is, I'm using Bugsnag (probably not the only library) that takes the exception and builds some internal structure (StackTraceLine - https://github.com/bugsnag/bugsnag-dotnet/blob/96360fb0f8d31f5fd6a8f3f17184bd626421820e/src/Bugsnag/Payload/Exception.cs#L85) before logging it. Therefore, the Demystifier has no effect.

Can we please get a Demystify() that cleans up the stack frames as well so that if the exception is used in another library it will not include the unnecessary stack frames?

btecu avatar Dec 18 '19 15:12 btecu

I have the same problem so i will support this proposal

Update

After few checks it seems to be work mostly correct. If i find a logic behind when it works and when not, i will post it here.

lutz avatar Sep 16 '20 15:09 lutz

Check my fork:https://github.com/mingmoe/Mingmoe.Demystifier?tab=readme-ov-file

You can use the formatted string like

string msg = exception.ToColoredStringDemystified();

And it won't change anything of the exception.

mingmoe avatar Jan 25 '24 12:01 mingmoe

Worth noting Sentry by default includes demystified stack traces image

It actually also includes snippets of the code, through source link or if you upload sources

bruno-garcia avatar Feb 02 '24 23:02 bruno-garcia