Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MAUI Window already created on specific devices

I'm getting a weird issue on my dotnet MAUI app, it works great for me, the issue doesn't run for any other phone but one person's One Plus.

AppCenter screenshot

I can't figure it out and I don't see any other issues posted online for this

I don't know what to even attempt other than remaking the entire app

like image 401
Benjamin Keller Avatar asked Dec 12 '25 16:12

Benjamin Keller


1 Answers

Same here with MAUI 8 preview. I can see the same error in the AppCenter with that OnePlus 8 device (Android 11), but I can't reproduce it.

Stacktrace:

Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Created()
Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.<OnConfigureLifeCycle>b__2_0(Activity activity, Bundle bundle)
Microsoft.Maui.MauiAppCompatActivity.<>c__DisplayClass8_0.<OnPostCreate>b__0(OnPostCreate del)
Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[OnPostCreate](IServiceProvider services, Action`1 action)
Microsoft.Maui.MauiAppCompatActivity.OnPostCreate(Bundle savedInstanceState)
Android.App.Activity.n_OnPostCreate_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState)
Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(_JniMarshal_PPL_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0)

Workaround

  • Override the MainActivity.cs/OnPostCreate method
  • Call base.OnPostCreate(savedInstanceState) in a try catch block.
like image 95
Andras Jani Avatar answered Dec 14 '25 10:12

Andras Jani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!