Hello,
I have the same issue as this one:
https://forums.xamarin.com/discussion/146590/showing-disable-xaml-generated-binding-debug-output-when-loading-a-page
https://forums.xamarin.com/discussion/147297/uwp-app-breaks-when-the-code-execution-comes-to-displayalert-line#latest
But the accepted answers does not work.
My solution works well on android, not with UWP.
From the main page, the app pushes async every pages well but pushing async the PositionsPage makes Redirect to App.g.i.cs:
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
This is the HomePage code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using AlmicantaratSharedProject.Ephemeris;
namespace AlmicantaratXF.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class HomePageXAML : ContentPage
{
public HomePageXAML()
{
InitializeComponent();
}
async void OnButtonTheoryClicked(object sender, EventArgs args)
{
await Navigation.PushAsync(new LessonTabPage(LessonTabPage.Lesson.theory));
}
async void OnButtonPracticeClicked(object sender, EventArgs args)
{
await Navigation.PushAsync(new LessonTabPage(LessonTabPage.Lesson.pratice));
}
async void OnButtonSettingsClicked(object sender, EventArgs args)
{
await Navigation.PushAsync(new SettingsPageXAML());
}
async void OnButtonPositionsClicked(object sender, EventArgs args)
{
Device.BeginInvokeOnMainThread(async () => //************ I added that to try to solve the problem
{
await Navigation.PushAsync(new PositionsPage()); //********** this is the line that redirects to the UnhandledException
});
}
async void OnButtonStarsClicked(object sender, EventArgs args)
{
var watch = System.Diagnostics.Stopwatch.StartNew();
string starname = App.StarsNames[1562].Designation(System.Globalization.CultureInfo.CurrentCulture);
string stardesignation = App.StarsNames[2081].Designation(System.Globalization.CultureInfo.CurrentCulture);
watch.Stop();
await DisplayAlert("Stars", starname+" "+stardesignation, "OK"); // ************* There is no issue there...
}
}
}