TTT
TTT

Reputation: 1885

Value cannot be null when launch Xamarin project

My current project was a blank project in which I copied the page and classes of Visual Studio's example, as I'm trying to understand how everything works in there.

Now, my project gets compiled, but when I run it I get

System.ArgumentNullException: Value cannot be null. Parameter name: newRoot at Xamarin.Forms.Platform.UWP.Platform.SetPage(Page newRoot) at Xamarin.Forms.Platform.UWP.WindowsBasePage.LoadApplication(Application application) at MyApp.UWP.MainPage..ctor() at MyApp.UWP.MyApp_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage() at MyApp.UWP.MyApp_UWP_XamlTypeInfo.XamlUserType.ActivateInstance()
at Windows.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at MyApp.UWP.App.OnLaunched(LaunchActivatedEventArgs e)

I would like to understand where this comes from and correct it.

Upvotes: 3

Views: 3189

Answers (1)

TTT
TTT

Reputation: 1885

Answer: This happened because I removed

MainPage = new MyApp.MainPage();

from MyApp\App.xaml.cs

Actually I had removed it and put it back, but for some reason, it appears that this type of project isn't really update until I did a new "Build" + "Deploy". I'm used to have to just re-build and had not re-deployed so my changes were not taken into account yet.

Upvotes: 5

Related Questions