Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generated Code Behind Throws System.ArgumentNullException

When I try and create a content view with XAML in Xamarin Forms the generated code-behind throws this error:

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>
like image 754
The Pademelon Avatar asked Dec 11 '25 02:12

The Pademelon


1 Answers

You just need to add xmlns="http://xamarin.com/schemas/2014/forms" to your root element. This error is thrown because no namespace is defined for your root element, as a result the parser can't determine the type of XML that's being parsed.

like image 165
The Pademelon Avatar answered Dec 13 '25 16:12

The Pademelon