由于 PreLaunch 测试,应用程序认证失败
App Certification fails because of PreLaunch Test
当我 运行 在基于模板 10 的应用程序上进行应用程序认证时,出现以下错误:
发现错误:应用程序启动前验证检测到以下错误:◦应用程序启动前测试失败 - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm.
•影响(如果未修复):即使启用了预启动,应用程序也将需要更长的时间才能启动。
•如何解决:在应用的 OnLaunched 方法实现中,确保处理 LaunchActivatedEventArgs.PreLaunch 选项以感知预启动事件。
显然,即使使用模板 10,我也无法覆盖 OnLaunched,因为 Bootstrap class 密封了它。
我尝试覆盖 OnPreLaunchAsync 并设置 continueStartup = false;但它并没有解决问题。
有什么想法吗?
是的,我遇到了这个问题,首先你更新到最新版本的模板 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();
}
希望对您有所帮助!
事实证明我能够发布到商店,并且它通过了认证,即使它在本地 Windows App Cert Kit 失败。
这似乎是 Windows App Cert Kit 的一个已知问题:https://developer.microsoft.com/en-us/windows/develop/app-certification-kit
"如果您 运行 在版本 1607(Windows 周年纪念版)。请注意,此测试不是 运行 作为 Windows 商店提交 "
最终认证的一部分
解决方案:为确保此测试的结果通过,请在 Windows-10 周年纪念日使用 Windows-10 SDK 版本 (14393) 运行ning 进行测试版本。
当我 运行 在基于模板 10 的应用程序上进行应用程序认证时,出现以下错误:
发现错误:应用程序启动前验证检测到以下错误:◦应用程序启动前测试失败 - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm.
•影响(如果未修复):即使启用了预启动,应用程序也将需要更长的时间才能启动。
•如何解决:在应用的 OnLaunched 方法实现中,确保处理 LaunchActivatedEventArgs.PreLaunch 选项以感知预启动事件。
显然,即使使用模板 10,我也无法覆盖 OnLaunched,因为 Bootstrap class 密封了它。
我尝试覆盖 OnPreLaunchAsync 并设置 continueStartup = false;但它并没有解决问题。
有什么想法吗?
是的,我遇到了这个问题,首先你更新到最新版本的模板 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();
}
希望对您有所帮助!
事实证明我能够发布到商店,并且它通过了认证,即使它在本地 Windows App Cert Kit 失败。
这似乎是 Windows App Cert Kit 的一个已知问题:https://developer.microsoft.com/en-us/windows/develop/app-certification-kit
"如果您 运行 在版本 1607(Windows 周年纪念版)。请注意,此测试不是 运行 作为 Windows 商店提交 "
最终认证的一部分解决方案:为确保此测试的结果通过,请在 Windows-10 周年纪念日使用 Windows-10 SDK 版本 (14393) 运行ning 进行测试版本。