Skip to content
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

Added Xamarin.Mac support #138

Merged
merged 7 commits into from
Jul 3, 2023
Merged

Added Xamarin.Mac support #138

merged 7 commits into from
Jul 3, 2023

Conversation

jonlipsky
Copy link

  • Added support for Xamarin.Mac applications
  • Added a Xamarin.Mac sample

Session logging is not implemented for Xamarin.Mac so an additional constant was added (LIFECYCLE_PROCESSOR) to for iOS, Android and UWP that do have that functionality. Previously, NATIVE_PROCESSOR was an indication that there were native implementations for both session logging and event processing.

Note 1: The same DSN that was used in the other samples was used.

Note 2: Something similar should be implemented for the Sentry.Maui project for the "net7.0-macos" framework as well.

* Added support for Xamarin.Mac applications
* Added a Xamarin.Mac sample
@bruno-garcia
Copy link
Member

I'm fine adding support here fwiw. Just need to get tests to pass

Note 2: Something similar should be implemented for the Sentry.Maui project for the "net7.0-macos" framework as well.

What part specifically you mean? for MAUI we have already the device info for example. And native crash support even

@jonlipsky
Copy link
Author

jonlipsky commented Jun 21, 2023

What part specifically you mean? for MAUI we have already the device info for example. And native crash support even

In Sentry.Maui, you are only building for MacCatalyst, not Mac (AppKit). You're missing a TargetFramework.

image

net6-macos is the missing TargetFramework.

@lucas-zimerman
Copy link
Collaborator

lucas-zimerman commented Jun 22, 2023

Hi and thank you for the PR!

A few notes from the build errors since you can't see the logs (I suppose)
MacOS is complaining with

  MMP : error MM0074: Xamarin.Mac 8.12.0 does not support a deployment target of 13.1 for macOS (the maximum is 12.3). Please select an older deployment target in your project's Info.plist or upgrade to a newer version of Xamarin.Mac. [/Users/runner/work/sentry-xamarin/sentry-xamarin/Samples/Sample.Xamarin.Mac/Sample.Xamarin.Mac.csproj]

On Windows:

  D:\a\sentry-xamarin\sentry-xamarin\Samples\Sample.Xamarin.Mac\SampleView.cs(54,27): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\sentry-xamarin\sentry-xamarin\Samples\Sample.Xamarin.Mac\Sample.Xamarin.Mac.csproj]
  D:\a\sentry-xamarin\sentry-xamarin\Samples\Sample.Xamarin.Mac\SampleView.cs(54,17): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\sentry-xamarin\sentry-xamarin\Samples\Sample.Xamarin.Mac\Sample.Xamarin.Mac.csproj]

@bruno-garcia
Copy link
Member

What part specifically you mean? for MAUI we have already the device info for example. And native crash support even

In Sentry.Maui, you are only building for MacCatalyst, not Mac (AppKit). You're missing a TargetFramework.

image `net6-macos` is the missing TargetFramework.

On their docs they mention "through Mac Catalyst": https://learn.microsoft.com/en-us/dotnet/maui/supported-platforms

What's the benefit/goal/tradeoff of supporting also netx.x-macos ?
We could continue this on a new issue on the https://github.com/getsentry/sentry-dotnet repo. Mind creating a ticket there please?

@jonlipsky
Copy link
Author

jonlipsky commented Jun 26, 2023

What's the benefit/goal/tradeoff of supporting also netx.x-macos ?

@bruno-garcia If you want to write a Mac .NET app that uses AppKit, as opposed the Catalyst/UIKit API's, then you need to target netX-macos. (netx-macos, is essentially the latest version of Xamarin.Mac).

MAUI doesn't support an AppKit backend; however like with Xamarin.iOS and Xamarin.Mac, the majority of the code that Sentry would need would be shared, thus it's probably the best place to add it.

@bruno-garcia
Copy link
Member

What's the benefit/goal/tradeoff of supporting also netx.x-macos ?

@bruno-garcia If you want to write a Mac .NET app that uses AppKit, as opposed the Catalyst/UIKit API's, then you need to target netX-macos. (netx-macos, is essentially the latest version of Xamarin.Mac).

MAUI doesn't support an AppKit backend; however like with Xamarin.iOS and Xamarin.Mac, the majority of the code that Sentry would need would be shared, thus it's probably the best place to add it.

Fair so we're talking about AppKit (Native Mac app with .NET) that targets netX.Y-macos which is .NET Core.
I'd be OK adding support on sentry-dotnet for it if @bitsandfoxes agrees

@jonlipsky
Copy link
Author

Fair so we're talking about AppKit (Native Mac app with .NET) that targets netX.Y-macos which is .NET Core. I'd be OK adding support on sentry-dotnet for it if @bitsandfoxes agrees

Thanks!

Also keep in mind there are developers, like myself, that do iOS and Android development that don't use MAUI. For example, my iOS apps target net7-ios; however, they don't reference or use MAUI.

Copy link
Contributor

@bitsandfoxes bitsandfoxes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this took a bit for me to wrap my head around. Thanks for contributing here!

@bitsandfoxes bitsandfoxes merged commit 9582b3f into getsentry:main Jul 3, 2023
@bruno-garcia
Copy link
Member

Fair so we're talking about AppKit (Native Mac app with .NET) that targets netX.Y-macos which is .NET Core. I'd be OK adding support on sentry-dotnet for it if @bitsandfoxes agrees

Thanks!

Also keep in mind there are developers, like myself, that do iOS and Android development that don't use MAUI. For example, my iOS apps target net7-ios; however, they don't reference or use MAUI.

That's fair. Sentry itself uses net7.0-android for Symbol Collector. Still benefits of support for Portable PDB to get line numbers in release builds, for example. So we're keen to get the base mobile support in the core SDK. And any MAUI specific only in Sentry.Maui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants