簡體   English   中英

生成的代碼背后拋出System.ArgumentNullException

[英]Generated Code Behind Throws System.ArgumentNullException

當我嘗試在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>

您只需要在根元素中添加xmlns="http://xamarin.com/schemas/2014/forms" 拋出此錯誤是因為沒有為根元素定義名稱空間,因此解析器無法確定要解析的XML的類型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM