Skip to content

Instantly share code, notes, and snippets.

@dansiegel
Created April 18, 2017 20:05
Show Gist options
  • Save dansiegel/d6827a98788e76c4e313ccffe99d1993 to your computer and use it in GitHub Desktop.
Save dansiegel/d6827a98788e76c4e313ccffe99d1993 to your computer and use it in GitHub Desktop.
Prism Debug
public partial class App : PrismApplication
{
public App(IPlatformInitializer initializer = null) : base(initializer)
{
}
protected override void OnInitialized()
{
try
{
// The most common problem when a view does not appear is an initialization exception.
Container.Resolve<object>("ViewA");
Container.Resolve<ViewModels.ViewAViewModel>();
// In the event that you got here then you can begin debugging by initializing INavigationAware
// ViewModels and/or manually setting the Application MainPage. This will likely result in an exception
// being thrown to help diagnose exactly where your problem is.
}
catch(Exception e)
{
System.Diagnostics.Debug.WriteLine("Whoops, looks like we threw an exception...");
System.Diagnostics.Debug.WriteLine(e);
}
NavigationService.NavigateAsync("ViewA");
}
protected override void RegisterTypes()
{
Container.RegisterTypeForNavigation<ViewA>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment