Closed mattjohnsonpint closed 1 year ago
Upstream issue: https://github.com/getsentry/sentry-dotnet/issues/2126
If it doesn't require a lot of changes, sharing the source code could ideal, unless the environment detection doesn't have a huge impact in performance for the other platforms.
@vaind - thoughts?
I've been doing some experimentation, and I think a good approach would be to split Sentry.Android.AssemblyReader
namespace out to its own Nuget package, targeting netstandard2.0
. We'd then take a dependency on that from both Sentry/net6.0-android
and Sentry.Xamarin/monodroid9.0
.
(I did try just creating a monodroid9.0
target of Sentry
, but that's not possible with the dotnet SDK).
To share the code, we can add SentryOptions.AssemblyReader
, of type Func<string, PEReader?>?
, and wire it to the Android assembly reader during initialization.
I think the assembly reader should be in its own GitHub repository also, so it can rev versions independently. That will also move the apk tests so they don't need to run on every Sentry build. Any objections?
Sounds good. Not sure if a split to another repo is necessary though. Is there currently only a single nuget package shipped from the sentry-dotnet repo?
No, there are several. Just they all version and deploy together by default. I can probably work around that though. I'll give it a try. 👍
Do we need different versions though? Maybe it's ok to push even though there were no changes. I guess that also happens for other packages
With Sentry.Xamarin 1.4.6, we are using Sentry 3.26.2, which (when configured) will upload symbols to Sentry during a release build. This part appears to work fine.
In testing, I found that filenames and line numbers are appearing for iOS Xamarin apps now, but not for Android Xamarin apps.
I believe this is because we aren't sending any of the
DebugImage
information in the stack frames with the exceptions. We do this for Android on MAUI (or anynet6.0-android
ornet7.0-android
app), but not for traditional Xamarin apps.It should be possible to fix this, either by sharing source code from Sentry .NET (
DebugStackTrace
,AndroidAssemblyReader
, etc.) or by modifying the code in Sentry to detect Android environment at runtime instead of compiling it only fornet6.0-android
.