![](/img/trans.png)
[英]Release mode UWP app crashes when in tablet mode and with code in OnSuspended
[英]UWP app crashes when not in debugging mode
我正在嘗試做什么:
對於我正在開發的UWP應用程序,我要求用戶使用其Google / FB憑據登錄才能訪問該應用程序的功能。 為此,我使用Auth0客戶端進行OAuth身份驗證。 成功登錄后,應將用戶導航到MainPage.xaml。 在調試應用程序時,這完全可以正常工作,沒有任何問題。
XAML:
<Button Margin="0,45,0,0" Grid.Row="6" HorizontalAlignment="Center" Name="GoogleSignIn" Content="Sign in with Google+" Tag="google-oauth2" Click="OAuthSignin" />
<Button Margin="0,15,0,0" Grid.Row="7" HorizontalAlignment="Center" Name="FacebookSignIn" Content="Sign in with Facebook" Tag="facebook" Click="OAuthSignin" />
代碼隱藏:
private async void OAuthSignin(object sender, RoutedEventArgs e)
{
string oauthprovider = ((Button)sender).Tag.ToString();
try
{
Auth0User user = await App.auth0.LoginAsync(oauthprovider);
if (user != null)
{
//Add user to credential locker
}
}
catch(Exception ex)
{
ex.ToString();
}
finally
{
var nav = Template10.Common.BootStrapper.Current.NavigationService;
nav.Navigate(typeof(Views.MainPage));
nav.ClearHistory();
}
}
出了什么問題:
由於該應用程序已部署到仿真器,因此我將停止調試並通過點擊圖塊啟動該應用程序。 我進入登錄頁面,輸入我的憑據。 按下Enter鍵后,我會立即看到它返回登錄頁面並在隨后崩潰。 如果我現在重新打開應用程序,我會發現我已經登錄,並且直接將我帶到MainPage.xaml(這是應用程序的邏輯)
我擔心的是:為什么在調試模式下它的行為會有所不同? 這妨礙了我,因為我無法設置斷點來確定導致崩潰的原因。
任何投入將不勝感激。
PS:我嘗試將應用程序部署到我的Lumia 640上,我在電話上也看到了相同的問題(這表示它與模擬器無關)。 桌面版本運行良好(即使在調試之外)。
我以前有這個問題。
我使用VS2015中用於調試uwp應用程序的新功能解決了調試我的應用程序的問題。 您需要在預啟動模式下調試應用。
我建議您選擇
不啟動,但調試我的應用程序選項
https://blogs.msdn.microsoft.com/visualstudioalm/2015/11/30/debug-uwp-prelaunch-with-vs2015/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.