Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The specified child already has a parent. You must call removeView() on the child's parent first." Facing this issue

I have used MAUI preview .and VS 2022 .When the application is run and used all functionality and press system back button and cloes the app.After cloesing the app I'm try to oepn the app that time

"{Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
" 

Is Occure on my mainActivity page .

    protected override void OnCreate(Bundle savedInstanceState)
    {
        try
        {
            // TEXTVIEW

            base.OnCreate(savedInstanceState);                           
            initFontScale();
            Microsoft.Maui.Essentials.Platform.Init(this, savedInstanceState);
            UserDialogs.Init(this);
            //Microsoft.Maui.Essentials.Platform.Init(this, savedInstanceState);
        }
        catch (System.Exception ex)
        {
        }
    }

How to resolve this error .

like image 431
user16258378 Avatar asked Nov 27 '25 10:11

user16258378


1 Answers

Seems like this was reported and according to the comment in there, this should be fixed for preview 11+: github.com/dotnet/maui/issues/3511 Which VS2022 have you installed?

Installing Visual Studio 2022 v17.1 Preview 2 should give you .NET MAUI Preview 11 which should resolve the issue.

like image 141
Gerald Versluis Avatar answered Nov 30 '25 06:11

Gerald Versluis