生成的代码后台抛出了 System.ArgumentNullException 异常

3
当我尝试在Xamarin Forms中使用XAML创建内容视图时,生成的代码会抛出以下错误:
System.ArgumentNullException: Value cannot be null. Parameter name: clrNamespace
at this.LoadFromXaml(typeof(MyXamlPage));
at InitializeComponent()

XAML:

<ContentPage
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="Adapt.Presentation.XamarinForms.MyXamlPage"
         Title="My Xaml Page">
    <ContentPage.Content>
        <Grid>
        </Grid>
    </ContentPage.Content>
</ContentPage>
1个回答

2
您只需在根元素中添加xmlns="http://xamarin.com/schemas/2014/forms"。出现此错误是因为未为根元素定义命名空间,因此解析器无法确定正在解析的XML类型。

兄弟,回答得真甜美! - Christian Findlay

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接