由于预启动测试,应用认证失败



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

发现错误:

应用预启动验证检测到以下错误:◦应用未通过预启动测试 - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm。

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

•解决方法:在应用的 OnLaunch 方法实现中,确保将 LaunchActivated EventArgs.PreLaunch 选项处理为预启动事件感知。

显然,即使使用模板 10,我也无法覆盖 OnLaunch,因为 Bootstrap 类会密封它。

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

有什么想法吗?

似乎是Windows应用证书工具包的已知问题:https://developer.microsoft.com/en-us/windows/develop/app-certification-kit

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

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

事实证明,我能够发布到商店,并且即使它在本地未通过本地 Windows 应用证书工具包,它也通过了认证。

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

接下来,我要做的是将 OnInitializeAsync 和 app.xaml.cs 中的 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();
    }

我希望这对您有所帮助!

最新更新