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
21.96k stars 1.7k forks source link

[Android] Setting IsBusy to True on MainPage of Shell app will cause crash #13138

Open euquiq opened 1 year ago

euquiq commented 1 year ago

Description

crashed app

Steps to Reproduce

Same as:

https://github.com/dotnet/maui/issues/12025

Link to public reproduction project repository

No need to create a project, happens with any ContentPage where I put IsBusy="True"

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12.1

Did you find any workaround?

Adding an ActivityIndicator control on the page (and the usual BaseViewModel solution (bool IsBusy, etc.)

Relevant log output

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C#
    0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C#
    0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:353,26    C#
    0x32 in System.Reflection.MethodInvoker.InterpretedInvoke   C#
    0x4 in System.Reflection.MethodInvoker.InlinedInvoke    C#
    0xCE in System.Reflection.RuntimeMethodInfo.Invoke  C#
    0x6 in System.Reflection.MethodBase.Invoke  C#
    0x95 in Microsoft.Maui.Controls.MessagingCenter.Subscription.InvokeCallback at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:97,5 C#
    0x70 in Microsoft.Maui.Controls.MessagingCenter.InnerSend at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:220,6  C#
    0x35 in Microsoft.Maui.Controls.MessagingCenter.Microsoft.Maui.Controls.IMessagingCenter.Send<Microsoft.Maui.Controls.Page, bool> at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:118,4  C#
    0x8 in Microsoft.Maui.Controls.MessagingCenter.Send<Microsoft.Maui.Controls.Page, bool> at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:111,4    C#
    0x7 in Microsoft.Maui.Controls.Page.<SendAppearing>b__119_0 at D:\a\_work\1\s\src\Controls\src\Core\Page.cs:489,32  C#
    0x33 in Microsoft.Maui.Controls.Page.FlushPendingActions at D:\a\_work\1\s\src\Controls\src\Core\Page.cs:270,6  C#
    0x15 in Microsoft.Maui.Controls.Page.SendNavigatedTo at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Page.Impl.cs:46,4  C#
    0x6C in Microsoft.Maui.Controls.Shell.SendNavigated at D:\a\_work\1\s\src\Controls\src\Core\Shell\Shell.cs:1166,4   C#
    0x2 in Microsoft.Maui.Controls.Shell.<.ctor>b__172_0 at D:\a\_work\1\s\src\Controls\src\Core\Shell\Shell.cs:803,49  C#
    0x1D in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:274,6   C#
    0x12 in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:264,7   C#
    0x22 in Microsoft.Maui.Controls.BaseShellItem.OnAppearing at D:\a\_work\1\s\src\Controls\src\Core\Shell\BaseShellItem.cs:168,5  C#
    0x136 in Microsoft.Maui.Controls.ShellNavigationManager.HandleNavigated at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:262,6   C#
    0x6D in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:243,7   C#
    0x65 in Microsoft.Maui.Controls.Element.OnChildAdded at D:\a\_work\1\s\src\Controls\src\Core\Element.cs:357,3   C#
    0x2 in Microsoft.Maui.Controls.ShellContent.OnChildAdded at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:153,4    C#
    0x28 in Microsoft.Maui.Controls.BaseShellItem.AddLogicalChild at D:\a\_work\1\s\src\Controls\src\Core\Shell\BaseShellItem.cs:274,4  C#
    0x30 in Microsoft.Maui.Controls.ShellContent.set_ContentCache at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:192,6   C#
    0x84 in Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:81,5  C#
    0x16E in Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRenderer.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellSectionRenderer.cs:123,5    C#
    0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at /Users/runner/work/1/s/generated/androidx.fragment.fragment/obj/Release/net6.0-android/generated/src/AndroidX.Fragment.App.Fragment.cs:2031,4 C#
    0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352,5  C#
drasticactions commented 1 year ago

Trying this on Android, I couldn't get this to crash on the template app, as you suggested.

Can you post what your workloads you're currently running? You can use 'dotnet workload list' to get them.

ghost commented 1 year ago

Hi @euquiq. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

euquiq commented 1 year ago

Can you post what your workloads you're currently running?

Sure:

Installed Workload Id Manifest Version Installation Source

maccatalyst 16.2.1007/7.0.100 VS 17.5.33326.253 ios 16.2.1007/7.0.100 VS 17.5.33326.253 android 33.0.26/7.0.100 VS 17.5.33326.253 maui-windows 7.0.59/7.0.100 VS 17.5.33326.253 maui-maccatalyst 7.0.59/7.0.100 VS 17.5.33326.253 maui-ios 7.0.59/7.0.100 VS 17.5.33326.253 maui-android 7.0.59/7.0.100 VS 17.5.33326.253

euquiq commented 1 year ago

I am using VS 2022 preview (latest). I just create a clean template Maui app (with the "clicked N times" example).

I compile it, it works fine.

I modify the MainPage.xaml, adding the IsBusy = "True" as in:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiAppCleanTemplate.MainPage"
             IsBusy="True">

Try to run again, and I get the unhandled exception right away.

Installed Workload Id Manifest Version Installation Source

maccatalyst 16.2.1007/7.0.100 VS 17.5.33326.253 ios 16.2.1007/7.0.100 VS 17.5.33326.253 android 33.0.26/7.0.100 VS 17.5.33326.253 maui-windows 7.0.59/7.0.100 VS 17.5.33326.253 maui-maccatalyst 7.0.59/7.0.100 VS 17.5.33326.253 maui-ios 7.0.59/7.0.100 VS 17.5.33326.253 maui-android 7.0.59/7.0.100 VS 17.5.33326.253

Unhandled Exception:

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C#
0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C#
0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:353,26    C#
0x32 in System.Reflection.MethodInvoker.InterpretedInvoke   C#
0x4 in System.Reflection.MethodInvoker.InlinedInvoke    C#
0xCE in System.Reflection.RuntimeMethodInfo.Invoke  C#
0x6 in System.Reflection.MethodBase.Invoke  C#
0x95 in Microsoft.Maui.Controls.MessagingCenter.Subscription.InvokeCallback at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:97,5 C#
0x70 in Microsoft.Maui.Controls.MessagingCenter.InnerSend at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:220,6  C#
0x35 in Microsoft.Maui.Controls.MessagingCenter.Microsoft.Maui.Controls.IMessagingCenter.Send<Microsoft.Maui.Controls.Page, bool> at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:118,4  C#
0x8 in Microsoft.Maui.Controls.MessagingCenter.Send<Microsoft.Maui.Controls.Page, bool> at D:\a\_work\1\s\src\Controls\src\Core\MessagingCenter.cs:111,4    C#
0x7 in Microsoft.Maui.Controls.Page.<SendAppearing>b__119_0 at D:\a\_work\1\s\src\Controls\src\Core\Page.cs:489,32  C#
0x33 in Microsoft.Maui.Controls.Page.FlushPendingActions at D:\a\_work\1\s\src\Controls\src\Core\Page.cs:270,6  C#
0x15 in Microsoft.Maui.Controls.Page.SendNavigatedTo at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Page.Impl.cs:46,4  C#
0x6C in Microsoft.Maui.Controls.Shell.SendNavigated at D:\a\_work\1\s\src\Controls\src\Core\Shell\Shell.cs:1166,4   C#
0x2 in Microsoft.Maui.Controls.Shell.<.ctor>b__172_0 at D:\a\_work\1\s\src\Controls\src\Core\Shell\Shell.cs:803,49  C#
0x1D in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:274,6   C#
0x12 in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:264,7   C#
0x22 in Microsoft.Maui.Controls.BaseShellItem.OnAppearing at D:\a\_work\1\s\src\Controls\src\Core\Shell\BaseShellItem.cs:168,5  C#
0x136 in Microsoft.Maui.Controls.ShellNavigationManager.HandleNavigated at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:262,6   C#
0x6D in Microsoft.Maui.Controls.ShellNavigationManager. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellNavigationManager.cs:243,7   C#
0x65 in Microsoft.Maui.Controls.Element.OnChildAdded at D:\a\_work\1\s\src\Controls\src\Core\Element.cs:357,3   C#
0x2 in Microsoft.Maui.Controls.ShellContent.OnChildAdded at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:153,4    C#
0x28 in Microsoft.Maui.Controls.BaseShellItem.AddLogicalChild at D:\a\_work\1\s\src\Controls\src\Core\Shell\BaseShellItem.cs:274,4  C#
0x30 in Microsoft.Maui.Controls.ShellContent.set_ContentCache at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:192,6   C#
0x84 in Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:81,5  C#
0x16E in Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRenderer.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellSectionRenderer.cs:123,5    C#
0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at /Users/runner/work/1/s/generated/androidx.fragment.fragment/obj/Release/net6.0-android/generated/src/AndroidX.Fragment.App.Fragment.cs:2031,4 C#
0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352,5  C#
ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

drasticactions commented 1 year ago

Okay, I was able to reproduce this.

If you have a app using Shell, and set "IsBusy" to "true" as the default on the page, that will cause the app to explode. If it's not set to true when you run the app and set it after the fact, it works fine. Moreover, it seems only to affect Shell apps. If"MainPage" is the rootview, it works fine.

SunshineSpring666 commented 1 year ago

Hi guys, Could this issue be resolved? Thanks.

jinxinjuan commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on android platform

Unhandled Exception: image