My objective is to extend an existing Xamarin project with UWP.
I have two shared projects , X.mobile.shared and X.application.shared , so i added reference for the Uwp project to this two project.
After following the steps to add uwp from the documentation, I have also installed all the Nuget packages available in these shared projects as it's noted in the answer of these issue .
Now when I debug the UWP project, I don't get any error but an unhandled exception, I tried to pin point the ligne that trigger that exception and I found that uncommenting this line:
rootFrame.Navigate(typeof(MainPage), e.Arguments);
Triggers the unhandled exception:
The message contains,as you see in the image:
Message "Object reference not set to an instance of an object."
which means that there is a referencing to a null object !
What am I doing wrong ?
Update
With a BreakPoint on the ligne triggering the error , i tried to see the value of the method is arguments , i found that DeclaringMethod called by typeofMain() is returning "SystemInvalidOpertaionException".
what that means ?
Update 2
Getting the advice of @Martin Zikmund , i checked the Stack trace and i found that the problem occurs at :
Acme.PhoneBookDemo.Core.Dependency.DependencyResolver.Resolve[T]()\r\n at Acme.PhoneBookDemo.App.OnStart()
back to that class, this is the code of OnStart() method:
protected override async void OnStart()
{
base.OnStart();
if (Device.RuntimePlatform == Device.iOS)
{
SetInitialScreenForIos();
await UserConfigurationManager.GetIfNeedsAsync();
}
await DependencyResolver.Resolve<INavigationService>().InitializeAsync();
OnResume();
}
the problem is triggred when the debugger arrive at this line:
await DependencyResolver.Resolve<INavigationService>().InitializeAsync();