Forum Visual Studio

there is problem creating an instance of *******.App in the previewer in visual studio

rks6121989rks6121989 Member ✭✭

Can somebody help to fix this issue.

Tagged:

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Here are the normal steps to Troubleshoot .

    • It can take some time for the Previewer to start up - you'll see "Initializing Render" until it's ready.
    • Try closing and reopening the XAML file.
    • Ensure that your App class has a parameterless constructor.
    • Check your Xamarin.Forms version - it has to be at least Xamarin.Forms 3.6. You can update to the latest Xamarin.Forms version through NuGet.
    • Check your JDK installation - previewing Android requires at least JDK 8.
    • Try wrapping any initialized classes in the page's C# code behind in if (!DesignMode.IsDesignModeEnabled).

    I also encountered this error before , please mark sure that you've updated everything(vs , package , sdk) to the latest, if problem persists , try to create a blank project to check if Previewer works .

  • rks6121989rks6121989 Member ✭✭

    Check your Xamarin.Forms version - it has to be at least Xamarin.Forms 3.6. You can update to the latest Xamarin.Forms version through NuGet.
    Check your JDK installation - previewing Android requires at least JDK 8.
    Try wrapping any initialized classes in the page's C# code behind in if (!DesignMode.IsDesignModeEnabled).

    these are the thing I need to check. Try wrapping any initialized classes in the page's C# code behind in if (!DesignMode.IsDesignModeEnabled). Do I need to wrap all the code in all code-behind files?

  • ColeXColeX Member, Xamarin Team Xamurai

    Do I need to wrap all the code in all code-behind files?

    No , i don't think it's necessary .

  • rks6121989rks6121989 Member ✭✭

    tried all the things but nothing seems to be working. Created a new project and it is working. What else can I try?

  • ColeXColeX Member, Xamarin Team Xamurai

    What is the version of your visual studio ? Is is the latest ?

Sign In or Register to comment.