App Certification fails because of PreLaunch Test
Asked Answered
H

3

12

When I run the App Certification on my Template 10 based app, I get the following error:

Error Found: The app prelaunch validation detected the following errors:◦The app failed prelaunch test - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm.

•Impact if not fixed: The app will take a longer time to launch, even when prelaunch is enabled.

•How to fix: In the OnLaunched method implementation of the app, ensure you handle the LaunchActivatedEventArgs.PreLaunch option to be prelaunch event aware.

Obviously I can't override the OnLaunched even with Template 10 because the Bootstrap class seals it.

I tried overriding the OnPreLaunchAsync and setting continueStartup = false; but it did not fix the problem.

Any ideas?

Henn answered 23/2, 2016 at 4:45 Comment(2)
When I set continueStartup = true; and I debug the Prelaunch in Visual Studio, the app runs fine. If continueStartup = false (or isn't set) it never runs OnInitializeAsync and I get a null reference exception on the OnStartAsync event.Henn
When I package the app and run the app cert test, it still fails on the PreLaunch test however. I tested it from VS with .net native enabled, and it worked fine.Henn
H
8

Turns out that I was able to publish to the store, and it passed certification even though it failed the local Windows App Cert Kit locally.

Henn answered 18/3, 2016 at 21:57 Comment(0)
P
9

This seems to be a known issue with Windows App Cert Kit: https://developer.microsoft.com/en-us/windows/develop/app-certification-kit

"The App Prelaunch Validation test will fail ig you run on a version of Windows-10 released before version 1607(Windows Anniversary Edition). Note that this test is not run as part of the final certification for Windows Store submissions"

Resolution: To ensure the results to this test pass, test with Windows-10 SDK Version (14393) running on Windows-10 Anniversary Edition.

Principalities answered 25/8, 2016 at 21:39 Comment(0)
H
8

Turns out that I was able to publish to the store, and it passed certification even though it failed the local Windows App Cert Kit locally.

Henn answered 18/3, 2016 at 21:57 Comment(0)
L
4

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!

Liquid answered 23/2, 2016 at 21:42 Comment(2)
Hmmm, I am running v1.1.4 of Template 10, and I only have the default code in the App.cs methods.Henn
Are you able to reproduce your error with the samples in template10? If not can you show me some code so I can better see you issue?Liquid

© 2022 - 2024 — McMap. All rights reserved.