microsoft / appcenter-sdk-dotnet

Development repository for the App Center SDK for .NET platforms, including Xamarin
Other
311 stars 141 forks source link

Add .NET MAUI Support #1647

Closed Mephisztoe closed 8 months ago

Mephisztoe commented 2 years ago

I was using the Analytics and Crash packages (Version 4.5.0) in my current .NET MAUI App and it worked for both Android and iOS. Now, on .NET MAUI RC3, AppCenter integration has stopped working and instead crashes on startup with a FileNotFoundException telling me it was missing Microsoft.Windows.Forms Version 4.0.0.0.

It would be awesome if AppCenter officially supported .NET MAUI as it is the next evolution of Xamarin.Forms. Also, .NET MAUI will reach GA most probably at Microsoft BUILD this month.

AnatolyPristensky commented 2 years ago

Hello @Mephisztoe, thank you for getting in touch with us! We've filed this feature request on our internal dashboard.

Syed-RI commented 2 years ago

Has there been any movement internally ?? MAUI has gone GA FYI

DmitriyKirakosyan commented 2 years ago

Hi @Syed-RI , we are currently working on it. The next release should include the full support for dotnet 6 and MAUI.

Syed-RI commented 2 years ago

@DmitriyKirakosyan Thanks a tonnnnnnn for the update!

busec0 commented 2 years ago

@DmitriyKirakosyan Any timeline on this? Are we talking weeks/months? Thanks!

stephenhauck commented 2 years ago

Bump ... Any idea when Appcenter will be able to build MAUI apps ?

Syed-RI commented 2 years ago

Bump ... Any idea when AppCenter will be able to build MAUI apps

stephenhauck commented 2 years ago

Bump ..... need to build MAUI apps

AnatolyPristensky commented 2 years ago

@Syed-RI, @stephenhauck, initial issue regarding App Center MAUI Build is here: https://github.com/microsoft/appcenter/issues/2360 Current issue is only related to the appcenter-sdk-dotnet and don't related with AppCenter Build features.

Mephisztoe commented 2 years ago

Something's happening: https://twitter.com/jfversluis/status/1575470486863200256

MatkovIvan commented 2 years ago

Yep, you can try 5.0.0-preview.1, it contains .NET 6 target.

And feel free to share your feedback about it, we're interested in it. Thanks

Syed-RI commented 2 years ago

Has anything changed in regards to how you initialise and register it? Such as can we use it with MAUI DependencyInjection?

wisdeom commented 2 years ago

Hi @Mephisztoe and all! As @MatkovIvan mentioned above our 5.0.0-preview.1 contains .NET 6 target. It should work for Distribution, Analytics, and Diagnostics packages. We'd love to get your feedback on this preview release. Please let us know and stay tuned with us for the full support for dotnet 6 and MAUI in the near future!

DmitriyKirakosyan commented 2 years ago

@Syed-RI , you can initialise AppCenter SDK in App.xaml.cs' ctor. See Apps/Contoso.MAUI.Demo/App.xaml.cs#L27 for the reference.

Syed-RI commented 2 years ago

@Syed-RI , you can initialise AppCenter SDK in App.xaml.cs' ctor. See Apps/Contoso.MAUI.Demo/App.xaml.cs#L27 for the reference.

I see, so nothing changed on the API surface. Still using static classes for crash and analytics

DmitriyKirakosyan commented 2 years ago

Yes, no API changes.

tipa commented 2 years ago

The preview version SDK does seem to be non-functional for me in a .NET6 macOS app. No sessions are being tracked, Analytics.TrackEvent & Crashes.GenerateTestCrash don't work at all either.

Mephisztoe commented 2 years ago

I created a new MAUI app from scratch yesterday and imported the following three NuGet packages:

I then initialized AppCenter within my MauiApp builder (CreateMauiApp) like so:

 AppCenter.Start(
                "ios=nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn;" +
                "android=nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn;",
                typeof(Analytics), typeof(Crashes));

And for simplicity reasons, I just forced a crash within the click handler in the templates' demo source:

Crashes.GenerateTestCrash();

I didn't test logging or error reporting features (yet). I didn't test MacOS, Tizen or Windows Targets; only Android and iOS.

However, AppCenter shows analytics and diagnostics information for both iOS and Android for me.

DmitriyKirakosyan commented 2 years ago

@tipa May I ask you for the details of your macos net6 app? Is it MAUI? Can you share verbose logs?

It would be helpful if you create a separate issue with the details.

tipa commented 2 years ago

@DmitriyKirakosyan I created a new issue here.

bez70 commented 2 years ago

Do we have any timeline as to when 5.0.0-preview.1 will make it into a stable release? This fixes an issue with AppCenter.Crashes on app startup I was experiencing after upgrading my Xamarin.ios app to Microsoft.ios .NET6 app. I am currently unable to release my updates to Apple as the app contains a pre release dependency.

DmitriyKirakosyan commented 2 years ago

Hi @bez70 , Can you create an issue with your crash or point to the existing one? net6.0-ios app should work normally with a preview version. If you refer to https://github.com/microsoft/appcenter-sdk-dotnet/issues/1692, my concern is that it might be a dotnet bug, not our SDK's. So the details about your project and environment will help us to investigate it further.

bez70 commented 2 years ago

Hi @DmitriyKirakosyan , my app does work normally with the preview version 5.0.0-preview.1, this fixes the issue in the stable release 4.5.3 that doesn't work. My issue is that I can't release my app with an potentially unstable dependency that is still in preview. Given Apples tight timescales on upgrading apps to the latest version of their OS I would like to know when the 5.0.0-preview.1 release will be published as a stable version?

DmitriyKirakosyan commented 2 years ago

Ah, got it, thank you for the clarification! We are currently working on the release, so I expect it to be published within two weeks.

DeerSteak commented 1 year ago

Did this ever happen? I just added 5.0.1 NuGet and call AppCenter.Start in App.xaml.cs in the OnStart method and get this exception on iOS:

Could not create a native instance of the type 'Microsoft.AppCenter.Apple.Bindings.MSACWrapperSdk': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

On Android it just freezes when I start debugging or install the app directly. I take out AppCenter.Start (and comment out the method bodies that do the logging) and it's fine.

MichaelShapiro commented 1 year ago

@DeerSteak Have you tried calling AppCenter.Start from the App.xaml.cs constructor instead of the OnStart method?

DeerSteak commented 1 year ago

@MichaelShapiro thanks for trying to help. That actually puts it earlier in the startup process, and does not help. The native class is still not loaded, it says.

DmitriyKirakosyan commented 1 year ago

@DeerSteak , You seem to face the same issue reported here https://github.com/microsoft/appcenter-sdk-dotnet/issues/1692.

Are you building your project on Windows machine? Can you reproduce it on a new app?

IlyaBausovAkvelon commented 1 year ago

@DeerSteak could you please provide information that @DmitriyKirakosyan asked for?

faze79 commented 1 year ago

@DeerSteak me too I'm looking for NET6 support of AppCenter, as previously reported version 5.0.1 is still failing to initialize and IsEnabledAsync() is returning false...

prabhav-mehra commented 1 year ago

@DeerSteak me too I'm looking for NET6 support of AppCenter, as previously reported version 5.0.1 is still failing to initialize and IsEnabledAsync() is returning false...

+1. I am also getting a crash on startup with my .net MAUI app when I try await Analytics.IsEnabledAsync() and await Crashes.IsEnabledAsync() on Android 12 emulator using arm64 Release build. Commenting this out stops the crash. I am using NET7

DmitriyKirakosyan commented 8 months ago

As we do not have plans to add support for this feature in the next year, I'm closing the issue.