getsentry / sentry-xamarin

Sentry for Xamarin Native and Xamarin.Forms
https://docs.sentry.io/platforms/dotnet/guides/xamarin/
44 stars 11 forks source link

1.5+ Breaks using Sentry 3.31 or higher #137

Closed tibuprophen closed 1 year ago

tibuprophen commented 1 year ago

Environment

Steps to Reproduce

(I'm using Rider, but the setup should be very similar to VS)

  1. New Solution Xamarin Application (Cross Platform, Xamarin.Forms, .NET Standard, API 31)
  2. Add Sentry.Xamarin.Forms 1.5.1 to all 3 Projects
  3. Update the default Sentry Package to 3.31 or higher
  4. Build App (with Release configuration)

Note: Using Sentry.Xamarin.Forms 1.4.6 will work with Sentry 3.31 or higher

Expected Result

No Errors

Actual Result

  Xamarin.Android.Legacy.targets(649, 5): [XALNK7000] Mono.Linker.MarkException: Error processing method: 'System.Void Xamarin.Forms.Platform.Android.ShellSearchView/ClipDrawableWrapper::.ctor(Android.Graphics.Drawables.Drawable)' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper
  at Mono.Linker.Steps.MarkStep.HandleUnresolvedType (Mono.Cecil.TypeReference reference) [0x00013] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x0002c] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at MonoDroid.Tuner.MonoDroidMarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00060] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at MonoDroid.Tuner.MonoDroidMarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x0001e] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <68c6268fbc45467eab046a8db2d5d932>:0 
   --- End of inner exception stack trace ---
  at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.Process () [0x000f6] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x0018f] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Xamarin.Android.Tasks.LinkAssemblies.RunTask () [0x0001b] in <68c6268fbc45467eab046a8db2d5d932>:0 
  at Microsoft.Android.Build.Tasks.AndroidTask.Execute () [0x00000] in <ef4d16f91c3a4b36914e1b20639be304>:0 

Thank you for any help and generally your work. Please tell me if you need further information.

lucas-zimerman commented 1 year ago

Out of curiosity, Does it also break if you remove the Sentry dependency? I noticed another project having issues with those latest packages for reference: https://github.com/xamarin/Xamarin.Forms/issues/15668

It seems like they introduced a break change with AndroidX packages and Xamarin that was fixed on MonoAndroid 13

tibuprophen commented 1 year ago

Hi it seems more complex. When I remove the Sentry dependency:

I'll try to upload an example very soon, where it breaks only by updating.

tibuprophen commented 1 year ago

Hi after upgrading and downgrading some dependencies, I found the real cause. In my app I use in another dependency the Sentry default package, with version 3.31.0. This seems not to work in combination with Sentry.Xamarin.Forms 1.5.1. But it is strange that Sentry 3.31.0 works with Sentry.Xamarin.Forms 1.4.6.

So you either need to downgrade Sentry.Xamarin.Forms to 1.4.6 to use the latest Sentry or you need to downgrade Sentry to use the latest Sentry.Xamarin.Forms.

michaelmairegger commented 1 year ago

The latest working version of Sentry in combination with Sentry.Xamarin is 3.33.0.

So, the solution is to either downgrade Sentry to 3.33.0 or to downgrade Sentry.Xamarin to 1.4.6

lucas-zimerman commented 1 year ago

Version 1.5.2 was released with support to Sentry 3.33.0. Is this still happening with you?

tibuprophen commented 1 year ago

Hello,

this Issue can be closed. Meanwhile, we've migrated our App to Maui. Since then the Issue is gone. Thank you for your Help!