Open emimvi opened 3 years ago
Hey @emimvi - thanks for the bug report! I think I may be missing some context here. What is the stack you expect to see when hitting F11 in the initialized WebView2 control? Have you put a breakpoint in ThrowingEventHandler
to verify that the F11-initialized-WebView2 scenario is getting hit?
@champnic I'd like to have global exception handler for unhandled exceptions (bugs), that can eg. log the error and exit the application. In the example, there is an uncaught exception in the event handler, that is always hit when the event is triggered. The inconsistency I'm experiencing is what happens after the exception is thrown.
For the initialized webview in the example, event is triggered, the event fires, prints the trace message, the exception is thrown, and then nothing happens.
For the uninitialized case (and other builtin winforms controls), the event fires, prints the trace message, exception is thrown, and then the ExceptionHandler
is triggered, allowing me to log the error and quit the application.
My issue is that to me, it appears as if the initialized WebView swallows the unhandled exception somehow, which makes me unable to log and exit the application.
Sounds good - I have opened this bug on our backlog to take a closer look. Thanks!
Description
When initialized with a Source, unhandled exceptions in WebView2 event handlers never trigger Application.ThreadException. Tested using WebView2 specific NavigationStarting event, and WinForms Control specific KeyDown. If Source is not set and the WebView2 is uninitialized, KeyDown events on the WebView properly triggers the ThreadException event.
Version SDK: 1.0.774.44 Runtime: Evergreen 90.0.818.39 Framework: WinForms OS: Win 10 Version 10.0.19041
Repro Steps
Press some key to trigger, eg. F11:
Expected output: Event fired from Microsoft.Web.WebView2.WinForms.WebView2 Unhandled exception! Application exits
Actual output: Event fired from Microsoft.Web.WebView2.WinForms.WebView2
Additional context I don't know if this is expected behavior, or whether it relates to the interprocess communication more than the actual webview. I tried looking for some documentation regarding this behavior but without luck.
AB#32726576