No UI threads in an event
You should not start a new UI thread in any of the webview2 events.
For example if you popup a simple messagebox somewhere in an event to return simple debugging info back to you then the WebView2 control itself complains in the debug window.
Debug Output:
Running a message loop synchronously in an event handler in Webview can cause reentrancy issue. Please refer to https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model#re-entrancy for more information about the used threading model in WebView2.
This means that you should not create a new dialog or other UI directly from within an event. Instead of that it is better to maintain state in the event for a variable or property and later on act on that state instead.
One way to do so is to start a timer from the event and start the UI from that timer instead.
AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/30/2024