Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppDomain.CurrentDomain.UnhandledException is not invoked on iOS #8463

Closed
busec0 opened this issue Jul 1, 2022 · 2 comments
Closed

AppDomain.CurrentDomain.UnhandledException is not invoked on iOS #8463

busec0 opened this issue Jul 1, 2022 · 2 comments
Labels
platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@busec0
Copy link

busec0 commented Jul 1, 2022

Description

AppDomain.CurrentDomain.UnhandledException is not invoked on iOS after an exception.

On Android it works.

Attached a Sample App:
TabbedPage.zip

iOS Recording:
https://user-images.githubusercontent.com/26183235/176889421-f19f517f-690f-45c7-aa61-e8775b18ed49.mov

Android Recording:
https://user-images.githubusercontent.com/26183235/176889906-e953378d-3ad5-4519-8ea2-7628bb058982.mov

Steps to Reproduce

  1. On a MAUI sample app, add the following code (in App.xaml.cs, within the constructor)
        AppDomain.CurrentDomain.UnhandledException += (s, e) =>
        {
            Console.WriteLine(" > > ON UnhandledException < < ");
            Console.WriteLine((e.ExceptionObject as Exception)?.ToString());
            Console.WriteLine(" - - - - - - ");
        };
  1. On the main page, add a simple button, with the following action:
    private void OnButtonClicked(object sender, EventArgs e)
    {
        Console.WriteLine("+ + Crashing Application ");
        Console.WriteLine("+ + Crashing Application ");
        throw new Exception("Random exception");
    }
  1. Build the application, load it on a device, make sure the debugger is not attached
  2. Bring up the Console app (for iOS logs) or adb logcat for Android.
  3. Open the application and click the button that will lead to the crash
  4. Inspect the logs. Notice on iOS the UnhandledException event is not raised and there are no logs except + + Crashing Application

Version with bug

Using dotnet 6.0.301 on a Mac, with Visual Studio for Mac 17.3 Preview (17.3 build 1038).

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.4

Did you find any workaround?

No. I noticed it sometimes works if with the debugger attached.

Relevant log output

No response

@busec0 busec0 added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 1, 2022
@jsuarezruiz jsuarezruiz added platform/iOS 🍎 s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jul 4, 2022
@jsuarezruiz
Copy link
Contributor

Verified with the attached sample.

@rolfbjarne
Copy link
Member

This is a duplicate of xamarin/xamarin-macios#15252.

@rolfbjarne rolfbjarne closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants