appcenter-sdk-dotnet icon indicating copy to clipboard operation
appcenter-sdk-dotnet copied to clipboard

Add .NET MAUI Support

Open Mephisztoe opened this issue 2 years ago • 31 comments

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.

Mephisztoe avatar May 13 '22 20:05 Mephisztoe

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

AnatolyPristensky avatar May 16 '22 09:05 AnatolyPristensky

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

Syed-RI avatar Jul 18 '22 15:07 Syed-RI

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

DmitriyKirakosyan avatar Aug 18 '22 07:08 DmitriyKirakosyan

@DmitriyKirakosyan Thanks a tonnnnnnn for the update!

Syed-RI avatar Aug 19 '22 08:08 Syed-RI

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

busec0 avatar Aug 31 '22 09:08 busec0

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

stephenhauck avatar Sep 06 '22 23:09 stephenhauck

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

Syed-RI avatar Sep 07 '22 08:09 Syed-RI

Bump ..... need to build MAUI apps

stephenhauck avatar Sep 13 '22 11:09 stephenhauck

@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.

AnatolyPristensky avatar Sep 13 '22 12:09 AnatolyPristensky

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

Mephisztoe avatar Sep 29 '22 19:09 Mephisztoe

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

MatkovIvan avatar Sep 30 '22 08:09 MatkovIvan

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

Syed-RI avatar Sep 30 '22 08:09 Syed-RI

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!

wisdeom avatar Sep 30 '22 09:09 wisdeom

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

DmitriyKirakosyan avatar Sep 30 '22 09:09 DmitriyKirakosyan

@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

Syed-RI avatar Sep 30 '22 09:09 Syed-RI

Yes, no API changes.

DmitriyKirakosyan avatar Sep 30 '22 11:09 DmitriyKirakosyan

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.

tipa avatar Oct 01 '22 08:10 tipa

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

  • Microsoft.AppCenter (5.0.0-preview.1)
  • Microsoft.AppCenter.Analytics (5.0.0-preview.1)
  • Microsoft.AppCenter.Crashes (5.0.0-preview.1)

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.

Mephisztoe avatar Oct 01 '22 09:10 Mephisztoe

@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.

DmitriyKirakosyan avatar Oct 11 '22 07:10 DmitriyKirakosyan

@DmitriyKirakosyan I created a new issue here.

tipa avatar Oct 11 '22 08:10 tipa

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.

bez70 avatar Oct 14 '22 08:10 bez70

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.

DmitriyKirakosyan avatar Nov 03 '22 04:11 DmitriyKirakosyan

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?

bez70 avatar Nov 03 '22 07:11 bez70

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.

DmitriyKirakosyan avatar Nov 03 '22 11:11 DmitriyKirakosyan

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.

DeerSteak avatar Jan 30 '23 17:01 DeerSteak

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

MichaelShapiro avatar Jan 30 '23 18:01 MichaelShapiro

@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.

DeerSteak avatar Jan 31 '23 03:01 DeerSteak

@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?

DmitriyKirakosyan avatar Feb 06 '23 08:02 DmitriyKirakosyan

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

IlyaBausovAkvelon avatar Feb 13 '23 23:02 IlyaBausovAkvelon

@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...

faze79 avatar Apr 03 '23 14:04 faze79