【问题标题】:Xamarin.Forms Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror' when trying to create MasterDetailPageXamarin.Forms 在尝试创建 MasterDetailPage 时无法将类型为“System.RuntimeType”的对象转换为类型“Mono.Debugger.Soft.TypeMirror”
【发布时间】:2019-03-22 03:32:51
【问题描述】:

我的 Xamarin.Forms 出现问题,不想再加载,它一直给我错误消息

Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'.

我的代码 ATM 是

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>

有人知道我为什么会收到这个错误吗?我唯一改变的是代码中 MainPage 从 ContentPageMasterDetailPage

的继承

【问题讨论】:

    标签: c# xaml xamarin.forms


    【解决方案1】:

    解决方法以防止“无法将 'System.RuntimeType' 类型的对象转换为 'Mono.Debugger.Soft.TypeMirror'”:

    • 将构建类型更改为 "Release" 而不是 "Debug"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-06
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-19
      • 1970-01-01
      相关资源
      最近更新 更多