I am using displayalert
in my project and it is working fine on android
and ios
devices. But for the UWP
part it is not working in some pages. When the code execution comes to displayalert
line the UWP
app breaks and redirecting to App.g.i.cs.
Code control comes to the following if block.
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
If I mouse over the e
showing {Windows.UI.Xaml.UnhandledExceptionEventArgs}
I am using the following code for display alert
:
await DisplayAlert("Alert", "A verification code has been sent to your email.", "OK");
If I changed the above lines like below, no issue will come.
Device.BeginInvokeOnMainThread(async () =>
{
await DisplayAlert("Alert", "A verification code has been sent to your email.", "OK");
});
Is there any solution to this issue without adding Device.BeginInvokeOnMainThread
? And what is the reason behind this issue?