-
-
Notifications
You must be signed in to change notification settings - Fork 230
fix: libmonosgen and libxamarin frames currently showing as inapp #4960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+77
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a691d2b
fix: libmonosgen and libxamarin frames currently showing as inapp
jamescrosswell 0312d6e
Fixed matching logic
jamescrosswell a46588b
Changelog
jamescrosswell e0cb929
Optimised regex expressions
jamescrosswell e817859
.
jamescrosswell 4f23fd8
Apply suggestions from code review
jamescrosswell 45d5543
Apply suggestions from code review
jamescrosswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| namespace Sentry.Internal; | ||
|
|
||
| internal static partial class InAppExcludeRegexes | ||
| { | ||
| // (^|[/\\]) — anchors to start of string or after a forward/backward slash | ||
| // ([^/\\]*libmonosgen[^/\\]*) — last segment contains libmonosgen (no slashes before/after) | ||
| // $ — end of string | ||
| private const string LibMonoSgenPattern = @"(^|[/\\])([^/\\]*libmonosgen[^/\\]*)$"; | ||
|
|
||
| // (^|[/\\]) — anchors to start of string or after a forward/backward slash | ||
| // ([^/\\]*libxamarin[^/\\]*) — last segment contains libxamarin (no slashes before/after) | ||
| // $ — end of string | ||
| private const string LibXamarinPattern = @"(^|[/\\])([^/\\]*libxamarin[^/\\]*)$"; | ||
|
|
||
| #if NET9_0_OR_GREATER | ||
| [GeneratedRegex(LibMonoSgenPattern)] | ||
| internal static partial Regex LibMonoSgen { get; } | ||
|
|
||
| [GeneratedRegex(LibXamarinPattern)] | ||
| internal static partial Regex LibXamarin { get; } | ||
| #elif NET8_0 | ||
| [GeneratedRegex(LibMonoSgenPattern)] | ||
| private static partial Regex LibMonoSgenRegex(); | ||
| internal static Regex LibMonoSgen { get; } = LibMonoSgenRegex(); | ||
|
|
||
| [GeneratedRegex(LibXamarinPattern)] | ||
| private static partial Regex LibXamarinRegex(); | ||
| internal static Regex LibXamarin { get; } = LibXamarinRegex(); | ||
| #else | ||
jamescrosswell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| internal static Regex LibMonoSgen { get; } = new(LibMonoSgenPattern, RegexOptions.Compiled); | ||
| internal static Regex LibXamarin { get; } = new(LibXamarinPattern, RegexOptions.Compiled); | ||
| #endif | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: use
RegexOptions.ExplicitCaptureand/orRegexOptions.CultureInvariantre
RegexOptions.ExplicitCaptureWhen the Regex-Pattern includes parentheses (
(and)), these are also "Capture Groups" per default. But not sure if we actually consume these automatically captures Groups ... where we may do some work that is not necessarily needed ... in other words: impacting performance slightly.We have three
IStringOrRegexMatcherDelimitedPrefixOrPatternMatcherRegex.MatchesPrefixOrPatternMatcherRegex.IsMatchSubstringOrPatternMatcherRegex.IsMatchOn the other hand ... although we are not actively using Capture Groups right now ... we might in the future and then the In-App detection might not work as expected.
I believe I'm actually talking myself out of this change now ... considering it's only about performance, not correctness.
re
RegexOptions.CultureInvariantNot sure if adding this option would actually be about correctness in our case ... perhaps also only performance.
I guess keeping the Regex-Options as they are (i.e.
RegexOptions.Compiledfor non-source-generated Regex) seems to be fine.What do you think?