dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

Starting a .NET MAUI iOS app in the debugger with Essentials enabled crashes #19264

Open vsfeedback opened 12 months ago

vsfeedback commented 12 months ago

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version]

Creating a File -> New .NET MAUI project and adding Essentials does not start on an iOS simulator or device, and the debugger bombs with an error.


Original Comments

b.runck on 9/21/2023, 00:33 PM:

(private comment, text removed)

Feedback Bot on 9/21/2023, 07:22 PM:

(private comment, text removed)

Rolf Kvinge [MSFT] on 10/13/2023, 09:25 AM:

(private comment, text removed)

b.runck on 10/16/2023, 01:13 PM:

(private comment, text removed)

b.runck on 10/16/2023, 01:44 PM:

(private comment, text removed)

Brian Runck on 10/19/2023, 03:54 PM:

(private comment, text removed)

Rolf Kvinge [MSFT] on 10/20/2023, 03:43 AM:

(private comment, text removed)

Feedback Bot on 10/20/2023, 04:05 AM:

(private comment, text removed)

Brian Runck on 11/14/2023, 01:28 PM:

(private comment, text removed)


Original Solutions

(no solutions)

reproduction

https://aka.ms/dc/file?name=B31830cc468ad4c7cb3d9f2d93c121e3f638330840055199225_MauiRc1App.zip&tid=31830cc468ad4c7cb3d9f2d93c121e3f638330840055199225

ghost commented 11 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

jamesmontemagno commented 11 months ago

Hmmm I am a bit confused by this...

You don't need:


        <UseMauiEssentials>true</UseMauiEssentials>

When you are in a .NET MAUI app it has .NET MAUI Essentials already, nor do you need the referenced nuget package.

If you do file -> new project i have everything working just fine here....

You do not need to do any Platform.Init or anything like that, it is already configured.

brunck commented 11 months ago

This came from this Xamarin migration document, specifically this section. It sounds like this information is now outdated.

However, the real problem is that doing the Platform.Init call, even if not actually necessary for Essentials, blows up the app with a StackOverflowException. Just run the reproduction sample to see this.

jamesmontemagno commented 11 months ago

Yes, but this is ONLY if you are migrating from Xamarin.iOS to iOS for .NET... not a full .NET MAUI app. I will give this feedback to @davidbritch here to make sure we outline that.

If you are migrating to a .NET 6/7/8 app that uses .NET MAUI as he bases all of this is done for you and Init is already called, so I want that to be known so you or anyone don't try to do additional work that isn't needed.

We should change the title that Platform.GetCurrentUIViewController has an issue in specific instances.

brunck commented 11 months ago

Yes and this migration guide is very confusing especially if you are migrating a multiple-project Xamarin.Forms app and not converting to single-project. In that case, you will have iOS-specific head projects that also need updating.

Hopefully the crash issue is not forgotten. That seems to be an iOS-only issue and not really suited for the MAUI repository.