我正在开发一个通用的Windows应用程序,它在Windows Phone,Phone Emulators上工作得很好但是当我尝试在本地计算机(桌面)上运行时,它会继续退出消息“App已退出代码1”我觉得有人用1发送退出信号,但为什么......?没有信息。
我发现了一些相关的问题,但没有他们有明确的答案。
任何帮助和建议都将不胜感激。
App.xaml.cs代码
public App()
{
this.InitializeComponent();
this.ExtendedSplashScreenFactory = (splashscreen) => new ExtendedSplashScreen(splashscreen);
#if DEBUG
HockeyClient.Current.Configure("Appid");
HockeyClient.Current.SendCrashesAsync();
#endif
// start live tiles updates
SportsClassLibrary.Common.SportsLiveTiles.StartPeriodicTileUpdate("https://tve.rpc.org/windows/sportsTile.cgi");
}
protected override Task OnInitializeAsync(IActivatedEventArgs args)
{
_container.RegisterType<IAlertDialogService, AlertDialogService>(new ContainerControlledLifetimeManager());
_container.RegisterType<IAccountService, AccountService>(new ContainerControlledLifetimeManager());
_container.RegisterType<IConfigService, ConfigServices>(new ContainerControlledLifetimeManager());
_container.RegisterInstance <INavigationService>(this.NavigationService);
_container.RegisterInstance<IEventAggregator>(new EventAggregator());
ServiceLocator.SetUnityContainer(_container);
// override the default viewmodel assembly location
Prism.Mvvm.ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
{
var viewModelTypeName = string.Format(System.Globalization.CultureInfo.InvariantCulture, "SportClassLibrary.ViewModels.{0}ViewModel,SportClassLibrary", viewType.Name);
var viewModelType = Type.GetType(viewModelTypeName);
return viewModelType;
});
return Task.FromResult<object>(null);
}
protected override object Resolve(Type type)
{
return _container.Resolve(type);
}
protected override async Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
{
if (args.PreviousExecutionState != ApplicationExecutionState.Running)
{
IConfigService configServices = (IConfigService)ServiceLocator.getServiceInstanceForType(typeof(IConfigService));
await configServices.GetConfigAsync();
}
this.NavigationService.Navigate(Experiences.Experience.Epg.ToString(), null);
}
}
所有方法都执行正常
答案 0 :(得分:1)
好的,我发现了这个问题,实际上我是在构造函数方法中异步发送崩溃报告到曲棍球,HockeyClient.Current.SendCrashesAsync();
将此代码移到OnInitializeAsync
方法修复此问题。