Redirecting to App.g.i.cs
when loading a page in xamarin UWP. 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 not understanding what is the problem? Is this related to some error in XAML? This issue is only on the windows app, Android and IOS apps parts are working fine.
XAML page code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Myproject.Pages.CodeValidationPage"
BackgroundColor="#00aff0">
<ScrollView>
<StackLayout
VerticalOptions="FillAndExpand">
<StackLayout
VerticalOptions="CenterAndExpand"
Orientation="Vertical">
<Image
Source="splash.png"
HeightRequest="120"
WidthRequest="120"
IsVisible="True"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand"/>
<Label
Text=" Please check your email for the verification code and activate your account. "
HorizontalOptions="CenterAndExpand"
x:Name="italic_test"
HorizontalTextAlignment="Center"
Margin="3"
Font="Italic,15"
TextColor="White"/>
<Frame
HorizontalOptions="FillAndExpand"
CornerRadius="10"
Margin="20"
Padding="0">
<StackLayout
BackgroundColor="White"
Orientation="Vertical"
VerticalOptions="CenterAndExpand" >
<Entry
x:Name="codeentry"
Margin="10,10,10,0"
Keyboard="Numeric"
Placeholder="Enter Verification Code"/>
<Entry
x:Name="passwordentry"
Placeholder="Password"
IsVisible="False"
Margin="10,10,10,0"
IsPassword="True"/>
<Entry
x:Name="confirmpasswordentry"
Margin="10,0,10,-10"
IsVisible="False"
Placeholder="Confirm Password"
IsPassword="True"/>
<Button
Text="Verify Code"
HeightRequest="40"
WidthRequest="150"
x:Name="validationButton"
TextColor="White"
HorizontalOptions="CenterAndExpand"
Font="Bold,15"
Margin="5,15,5,10"
BorderRadius="20"
BackgroundColor="#00aff0"
Clicked="SaveNewPassword"/>
</StackLayout>
</Frame>
</StackLayout>
<Label
VerticalOptions="EndAndExpand"
HorizontalOptions="CenterAndExpand"
Margin="0,0,0,15"
x:Name="backto_label"
TextColor="White"
Font="Bold,16"
Text=" Back to Sign Up "/>
</StackLayout>
</ScrollView>
</ContentPage>
The real problem is with the disaplayalert
.
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");
});