C# Xamarin.Forms无法强制转换类型为';System.RuntimeType';输入';Mono.Debugger.Soft.TypeMirror';尝试创建MasterDetailPage时

C# Xamarin.Forms无法强制转换类型为';System.RuntimeType';输入';Mono.Debugger.Soft.TypeMirror';尝试创建MasterDetailPage时,c#,xaml,xamarin.forms,C#,Xaml,Xamarin.forms,我的Xamarin有问题。表单不想再加载了,它一直给我错误消息 Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'. 我的代码是自动取款机 MainPage.xaml.cs: public partial class MainPage : MasterDetailPage { public MainPage() {

我的Xamarin有问题。表单不想再加载了,它一直给我错误消息

Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'.
我的代码是自动取款机

MainPage.xaml.cs:

public partial class MainPage : MasterDetailPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
    }
MainPage.xaml

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

    <MasterDetailPage.Master>
        <ContentPage Title="Master">
            <StackLayout>
                <!-- Click event method nog toevoegen -->
                <Button Text="RandomColorPage"></Button>
                <Button Text="CarouselPage"></Button>
            </StackLayout>
        </ContentPage>
    </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <!--<local:ImageViewerPage />-->
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>


有人知道我为什么会收到这个错误吗?我唯一更改的是将代码中的主页继承从ContentPage改为MasterDetailPage

变通方法,以防止“无法将'System.RuntimeType'类型的对象强制转换为'Mono.Debugger.Soft.TypeMirror'”:

  • 将生成类型更改为“发布”,而不是“调试”