CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

Unable to get the correct type of exception

Open Daoting opened this issue 2 years ago • 2 comments

Describe the bug

When a custom exception is triggered, the correct exception type cannot be obtained in the unhandled exception event.

Steps to reproduce the bug

Attach the UnhandledException event

       public App()
        {
            this.InitializeComponent();
            UnhandledException += OnUnhandledException;
        }

        private void OnUnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
        {

        }

Throws a custom exception

    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
        }

        private void myButton_Click(object sender, RoutedEventArgs e)
        {
            throw new KnownException("LOB Warning");
        }
    }

    public class KnownException : Exception
    {
        public KnownException(string p_message)
            : base(p_message)
        {
        }
    }

Unable to get the correct type of exception

image

Expected behavior

No response

Screenshots

No response

NuGet package version

1.0.0

Packaging type

Packaged (MSIX)

Windows version

No response

IDE

Visual Studio 2022-preview

Additional context

No response

Daoting avatar May 11 '22 07:05 Daoting

Please check if it is a bug.

Daoting avatar Aug 05 '22 08:08 Daoting

I'm facing the same issue. Will this bug ever be fixed?

Gabboxl avatar May 07 '23 13:05 Gabboxl