Xamarin.Forms Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror' when trying to create MasterDetailPage

妖精的绣舞 提交于 2021-01-24 12:09:52

问题


I am having problems with my Xamarin.Forms not wanting to load anymore, it keeps giving me the error message

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

My code ATM is

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>

Does anyone know why I am receiving this error? The only thing I changed was the inheritance of the MainPage in the code from ContentPage to MasterDetailPage


回答1:


Workaround in order to prevent "Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'":

  • Change build type to "Release" as opposed to "Debug"


来源:https://stackoverflow.com/questions/52855130/xamarin-forms-unable-to-cast-object-of-type-system-runtimetype-to-type-mono-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!