由于PreLaunch测试

时间:2016-02-23 04:45:54

标签: windows-10-universal template10

当我在基于Template 10的应用上运行App认证时,出现以下错误:

发现错误:应用程序预启动验证检测到以下错误:◦应用程序启动前测试失败 - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm。

•影响如果不修复:即使启用了预启动,应用也需要更长的时间才能启动。

•如何修复:在应用程序的OnLaunched方法实现中,确保您处理LaunchActivatedEventArgs.PreLaunch选项以预启动事件感知。

显然,即使使用Template 10,我也无法覆盖OnLaunched,因为Bootstrap类会对其进行封锁。

我尝试重写OnPreLaunchAsync并设置continueStartup = false;但它没有解决问题。

有什么想法吗?

3 个答案:

答案 0 :(得分:9)

这似乎是Windows App Cert Kit的一个已知问题:https://developer.microsoft.com/en-us/windows/develop/app-certification-kit

应用程序预启动验证测试将失败ig您在版本1607(Windows周年纪念版)之前发布的Windows-10版本上运行。请注意,此测试不作为最终认证的一部分运行对于Windows应用商店提交

分辨率:要确保此测试通过的结果,请使用在Windows-10周年纪念版上运行的Windows-10 SDK版本(14393)进行测试

答案 1 :(得分:8)

事实证明我能够发布到商店,即使它在本地Windows App Cert Kit失败也通过了认证。

答案 2 :(得分:4)

是的,我有这个问题,首先让您更新到最新版本的模板10(1.1.4):https://www.nuget.org/packages/template10

接下来我要做的就是将我在app.xaml.cs中的OnInitializeAsync和OnStartAsync中的所有代码移动到App()中。

您需要尽可能保持OnInitializeAsync和OnStartAsync的精简,您应该只保留基本的Template10代码并在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;
        }

在App()中,我为我的应用程序添加了所有我的初始化方法,所以我的App()看起来像这样:

    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();
    }

我希望这可以帮助你!