Unhandeled exception not fire when there is fatal exception

Dani_S 4,501 Reputation points
2024-02-01T10:47:49.6666667+00:00

Hi, Unhandeled exception not fire when there is fatal exception And make the http query.

In debugger it works only when it syronous https call.. I comment all code in realse and add code that write to log and is not working. File.WriteAllText(@"D:\1.txt", "Test"); That mean it not reach in handele exception in realse mode?

Thanks,

using Autofac;
using GssdDesktopClient.API.Imp;
using GssdDesktopClient.Maui.Helpers;
using GssdDesktopClient.Maui.Startup;

namespace GssdDesktopClient.Maui
{
    public partial class App : Application
    {

        public App()
        {
            InitializeComponent();

            //MainPage = new AppShell();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }

        private async void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(LoginConfigurations.GetInstance().SessionToken))
                {
                    var container = new Bootstrapper().Bootstrap();
                    IAutomationApiClient automationApiClient = container.Resolve<IAutomationApiClient>();
                    var res = await automationApiClient.PostLogOut($"{LoginConfigurations.GetInstance().Portal}/api/GSPortal/PostLogOut/false", LoginConfigurations.GetInstance().SessionToken);
                }
            }
            catch (Exception)
            {
            }


        }

        public static Window window;
        protected override Window CreateWindow(IActivationState activationState)
        {
            window = new Window(new AppShell());
            return window;
        }


    }
}
Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.