Caroline
Caroline

Reputation: 236

Cannot find System.Runtime assembly while initializing XAML Previewer

An error occurs when I'm trying to load XAML Previewer for Xamarin.Forms.

Cannot find System.Runtime assembly (see screenshot) while initializing renderer.

Target framework: .Net Standart 2.0.
Installed assemblies: NetStandart.Library 2.0.3, Xamarin.Forms 4.0.0.425677.

XAML code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:XamarinLab"
             x:Class="XamarinLab.MainPage"
             Title="Authorization">

    <ScrollView>
        <AbsoluteLayout BackgroundColor="SkyBlue">
            <Frame AbsoluteLayout.LayoutBounds="0.5, 0.5, -1, -1" AbsoluteLayout.LayoutFlags="PositionProportional" HasShadow="True" CornerRadius="15">
                <StackLayout WidthRequest="150">
                    <Entry x:Name="LoginEntry" Placeholder="login"/>
                    <Entry x:Name="PasswordEntry" Placeholder="password" IsPassword="True"/>
                    <Button Text="Sign In" Clicked="OnLoginButtonClicked" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
                    <Button Text="Sign Up" Clicked="OnRegisterButtonClicked" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
                </StackLayout>

            </Frame>

            <ActivityIndicator x:Name="Loading" Margin="5" Color="White" IsRunning="False" AbsoluteLayout.LayoutBounds=".5,0,100,40" AbsoluteLayout.LayoutFlags="PositionProportional"/>
        </AbsoluteLayout>
    </ScrollView>

</ContentPage>

The error:

The error screenshot

Upvotes: 0

Views: 43

Answers (1)

Cherry Bu - MSFT
Cherry Bu - MSFT

Reputation: 10346

According to your description, you have some issue when you want to use xaml previewer.

From XAML Previewer for Xamarin.Forms, you can check the following steps:

XAML Previewer isn't showing or shows an error

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).

You said that your xamarin.forms version is 4.0.0.425677, can you uninstall and install other version( for example 3.6) to try again

Upvotes: 1

Related Questions