sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Mark mono/xamarin/dotnet system symbols as not inApp (iOS)

Open bruno-garcia opened this issue 8 months ago • 5 comments

Example event: https://demo.sentry.io/issues/6610741528/?project=4509153190739968&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=0

Image

bruno-garcia avatar May 16 '25 21:05 bruno-garcia

Tricky, the JSON for those frames doesn't include any Module information:

            {
              "function": "mono_jit_exec",
              "symbol": "mono_jit_exec",
              "package": "/Users/jamescrosswell/Library/Developer/CoreSimulator/Devices/CFB78342-B78D-48E0-87A2-3B3A1311A8EE/data/Containers/Bundle/Application/0B1D5D54-E77B-4582-9033-B45046B4C46C/Sentry.Samples.Maui.app/libmonosgen-2.0.dylib",
              "in_app": true,
              "data": {
                "orig_in_app": 0,
                "client_in_app": false,
                "symbolicator_status": "symbolicated"
              },
              "image_addr": "0x1158d8000",
              "instruction_addr": "0x11593ea3c",
              "symbol_addr": "0x11593e8d4"
            },

The currently implementation of InAppExcludes only matches against either Module or Function and trying to identify all of the function names to match against isn't very practical.

Ideally we could exclude based on the package name (e.g. libmonosgen bit in the example frame above).

jamescrosswell avatar May 26 '25 01:05 jamescrosswell

it's in package the json you shared

bruno-garcia avatar May 26 '25 02:05 bruno-garcia

it's in package the json you shared

Yes I see that. That's why I added this to my comment:

Ideally we could exclude based on the package name (e.g. libmonosgen bit in the example frame above).

Do we want to do this though? These are our current Excludes: https://github.com/getsentry/sentry-dotnet/blob/aae73422bd34e427ff2e03928e9cea30e924f8ae/src/Sentry/SentryOptions.cs#L1296-L1337

I'm wary about any of those accidentally matching against package names when they were designed to match module names.

We could probably do it if we were careful about how we designed the matcher. These are the two matchers we have for Module and Function: https://github.com/getsentry/sentry-dotnet/blob/34b55980cd9f84d3922f80ff70c87b76d38ae01d/src/Sentry/SentryStackFrame.cs#L19-L20

To match against packages, we'd need a regex that could unpack something like this "/some/path/libmonosgen-2.0.dylib"

jamescrosswell avatar May 26 '25 06:05 jamescrosswell

I'm wary about any of those accidentally matching against package names when they were designed to match module names.

marking code as InApp takes priority so if users are explicitly marking something it should be fine. We can also write some during build with our msbuild plugin? Check everything that's being compiled in and mark all of those as InApp?

To match against packages, we'd need a regex that could unpack something like this "/some/path/libmonosgen-2.0.dylib"

We could do contains (libmono) or (monosgen)

bruno-garcia avatar May 26 '25 14:05 bruno-garcia

We would like to add a dedicated "Package-Matcher" next to the existing "Module-" and "Function-Matchers". https://github.com/getsentry/sentry-dotnet/blob/9beef00b325bd79c2cf43829f069142461aec113/src/Sentry/SentryStackFrame.cs#L19-L20 See also https://github.com/getsentry/sentry-dotnet/pull/4236#discussion_r2122614108

Flash0ver avatar Jun 03 '25 09:06 Flash0ver