Conversation
| public partial class StringStackTraceFactory : ISentryStackTraceFactory | ||
| { | ||
| private readonly SentryOptions _options; | ||
| private const string FullStackTraceLinePattern = @"at (?<Module>[^\.]+)\.(?<Function>.*?) in (?<FileName>.*?):line (?<LineNo>\d+)"; |
There was a problem hiding this comment.
Is this regex coming from another file in the repo or it's a new regex? curious how tested/vetted this is
There was a problem hiding this comment.
It's a new regex and the short answer is "not very"... which is one reason this is marked as Experimental.
We do have these unit tests but I'm not sure what this string is likely to look like in all the different real world scenarios.
This one (the fallback) is the regex that @filipnavara is using here:
I'm hoping that between the two of those we can extract something sensible.
There was a problem hiding this comment.
We have been using this regex in production since October 2024. It may not be fool-proof but it's somewhat battle-tested.
| ## Unreleased | ||
|
|
||
| ### Features | ||
|
|
There was a problem hiding this comment.
Is it on by default on AOT then?
How do I turn it on?
Would be nice to have a mention of that in the changelog too.
There was a problem hiding this comment.
Perhaps something we could also document in Troubleshooting when released?
There was a problem hiding this comment.
Yeah when @Flash0ver and I discussed we were thinking we wouldn't promote this too widely, since it's quite experimental. However there are some additional docs on SentryOptions.UseStackTraceFactory (which is how you'd add this):
sentry-dotnet/src/Sentry/SentryOptions.cs
Lines 1637 to 1643 in e4120a9
And we figured we'd add something to our troubleshooting docs as well...
I'll add a blurb in the description of this PR as well.
bruno-garcia
left a comment
There was a problem hiding this comment.
Some notes on changelog otherwise lgtm
Resolves #3439
Description and Usage
This PR introduces a new stack trace factory that SDK users can enable explicitly for AOT compiled applications only if they're not getting useful stack traces from the default
SentryStackTraceFactory.It can be enabled via the
SentryOptionswhen initialising Sentry:If this proves useful enough, we can simplify how that gets wired up.
Initial testing
I tested this out with the sample code from the related issue and the resulting stack trace is worse than what you get from the
SentryStackTraceFactory.For folks who aren't getting any stack trace at all, this might be an improvement... although I'm unable to reproduce a scenario where I don't have any stack trace.
Examples
SentryStackTraceFactory
SimpleStackTraceFactory