Yes i had this problem, first have you updated to the lastest version of Template 10 (1.1.4): https://www.nuget.org/packages/template10
Next what I had to do was move all of my code that was in OnInitializeAsync and OnStartAsync that was in app.xaml.cs into the App().
You need to keep OnInitializeAsync and OnStartAsync as lean as possible, you should keep only the essential Template10 code in them and add your specific code in App().
public override Task OnInitializeAsync(IActivatedEventArgs args)
{
// content may already be shell when resuming
if ((Window.Current.Content as ModalDialog) == null)
{
// setup hamburger shell
var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);
Window.Current.Content = new ModalDialog
{
DisableBackButtonWhenModal = true,
Content = new Shell(nav),
ModalContent = new Views.Busy(),
};
}
return Task.CompletedTask;
}
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
NavigationService.Navigate(typeof(MainView));
return Task.CompletedTask;
}
In App() I added all my my initialization methods for my app so my App() looks liek this:
public App()
{
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
WindowsCollectors.Metadata |
WindowsCollectors.UnhandledException |
WindowsCollectors.PageView |
WindowsCollectors.Session
);
this.InitializeComponent();
var element = new ViewModelLocator();
//Template10.Services.LoggingService.LoggingService.Enabled = true;
//Template 10 stuff
// DOCS: https://github.com/Windows-XAML/Template10/wiki/Docs-%7C-Cache
CacheMaxDuration = TimeSpan.FromDays(1);
// DOCS: https://github.com/Windows-XAML/Template10/wiki/Docs-%7C-BackButton
ShowShellBackButton = SettingsService.Instance.UseShellBackButton;
// DOCS: https://github.com/Windows-XAML/Template10/wiki/Docs-%7C-SplashScreen
SplashFactory = (e) => new Views.Splash(e);
//My code here
ApiRoot.Instance.Init();
InitDeviceTypeAndResource();
InitApiLanguage();
InitAppLanguage();
InitABCRatings();
//For updating Tiles
RegisterBackgroundTask();
}
I hope that this helps you out!