Closed abenadar closed 1 month ago
Same issue here. At the moment it looks like Sentry is not compatible with Xamarin apps
Same issue here. At the moment it looks like Sentry is not compatible with Xamarin apps
At least not Xamarin apps relying on MAUI essentials rather than Xamarin.Essentials, which looks like a massive oversight to me. I bumped this issue to the customer support as I was in contact with them anyway. Ticket has fallen stale since then. Guess I'll have to look for alternatives.
Hey @abenadar, @kkabala! Sorry about that, this slipped past by us somehow. We're looking into it.
Hi, this SDK is only compatible with Sentry Xamarin but not MAUI. For MAUI we have another SDK that you can check out here: https://docs.sentry.io/platforms/dotnet/guides/maui/ please let us know if the MAUI SDK is working with your project.
@lucas-zimerman Thanks for looking into this.
The MAUI package as documented is not an option for me as I am not using MAUI as a framework, merely its Essentials libraries. However, I can confirm by now that usage of <UseMauiEssentials>true</UseMauiEssentials>
has no bearing on the issue (I recall it clashing with Xamarin.Essentials being a potential cause though).
I am using plain .NET-iOS/.NET-Android with Uno Platform on top, with independent project heads as mentioned above. hence using the plain Sentry.Xamarin seemed as the obvious solution.
Interestingly enough, the exception does not occurr on the Android simulator (haven't tested physical devices yet). ~Though I haven't received a record fromSentrySdk.CaptureMessage
yet~.
The problem here is mixing Xamarin with new, .NET mobile stuff.
net8.0-xyz
isn't supported by Xamarin. Xamarin still (and will only, since it's out of support already) target monoandroid11.0
and such TFMs, as we do in this package:
Xamarin.Essentials.NotImplementedInReferenceAssemblyException
this exception is telling me a package is being pulled for net8.0
for example, where only reference assembly exists (no code), and then building an app for a TFM that it doesn't have a proper DLL for.
So for example you're building an app for monoandroid11.0
but the NuGet package only has net8.0-android
with actual code. SInce that's the new MAUI Essentials stuff.
I recommend keeping the Xamarin apps out of any new msbuild-style csproj or MAUI references. Sentry's Xamarin SDK is still compatible with Xamarin, but you'll have issues with Xamarin if you start trying to mix with new .NET 8 dependencies.
I am using plain .NET-iOS/.NET-Android with Uno Platform on top, with independent project heads as mentioned above. hence using the plain Sentry.Xamarin seemed as the obvious solution.
Sentry itself Sentry
core package does have targets for net8.0-ios
etc btw. If you're not building a Xamarin app, but just a native mobile app with .NET using net8.0-android
, net8.0-ios
etc, you don't need this Sentry.Xamarin
package. You can use Sentry
which targets these native TFMs and includes our native SDKs.
https://www.nuget.org/packages/Sentry#supportedframeworks-body-tab
@bruno-garcia Thank you, I think using the regular Sentry package indeed brought us on the right track. I will make sure everything works as expected now on every platrform and close the issue/get back to you as soon as I have news.
Feel free to reopen or open a new ticket if there are issues
Environment
I have three seperate projects each targeting a different platform.
<UseMauiEssentials>true</UseMauiEssentials>
is used for all, but no Maui itself.Most source files lie in a shared project (not a CL) reference by the tree projects.
Steps to Reproduce
Add a call to the SDK in a source file contained in the shared project:
Expected Result
The project builds successfully.
Actual Result
The build fails with a
Xamarin.Essentials.NotImplementedInReferenceAssemblyException
.I could see this appearing if the shared project was a class library which itself had the only reference to Sentry.Xamarin. However, the main projects do contain the reference.
Since the issue is apparently caused by the underlying Xamarin.Essentials reference I was thinking about using the Maui package, but it appears to use Extensions unavailable in a pure Xamarin project.