I'm trying to create an app that uses the [WebView2](https://developer.microsoft.com/en-us/microsoft-edge/webview2/) WPF component. Currently I'm working on logging the messages and errors that are written by the javascript code of the websites using `console.log()`.

This is what I have right now:

```
public partial class WebView2BrowserControl : WebView2
{
    private async void OnWebViewLoaded(object sender, RoutedEventArgs e)
    {
        await EnsureCoreWebView2Async();
        if (showDeveloperTools)
        {
            CoreWebView2.GetDevToolsProtocolEventReceiver("Log.entryAdded").DevToolsProtocolEventReceived += OnConsoleMessage;
            CoreWebView2.OpenDevToolsWindow();
        }
        else
        {
            CoreWebView2.Settings.AreDevToolsEnabled = false;
        }
    }

    private void OnConsoleMessage(object sender, CoreWebView2DevToolsProtocolEventReceivedEventArgs e)
    {
        if (e != null && e.ParameterObjectAsJson != null)
        {
            Trace.WriteLine("WebView2:" + e.ParameterObjectAsJson);
        }
    }
}

```

As you can see, I'm using the [GetDevToolsProtocolEventReceiver](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.getdevtoolsprotocoleventreceiver?view=webview2-dotnet-1.0.705.50#Microsoft_Web_WebView2_Core_CoreWebView2_GetDevToolsProtocolEventReceiver_System_String_) method to subscribe to events in the DevTools. The documentation states the following:

*eventName:String - The full name of the event in the format {domain}.{event}.*
*For more information about DevToolsProtocol events description and event args, navigate to DevTools Protocol Viewer.*

...And acording to the *DevTools Protocol Viewer* the event that I'm looking for is [Log.entryAdded](https://chromedevtools.github.io/devtools-protocol/tot/Log/#event-entryAdded).

Now the problem is that while the `GetDevToolsProtocolEventReceiver("Log.entryAdded")` call does not throw any exception the event is never raised, even if I can see things being logged in DevTools. I even tried writing my own `console.log()` calls in the DevTools window.

Other things that I've tried:

* using both the Evergreen Standalone Installer which installs WebView2 on the machine or the Fixed Version (both 87 and 88 versions) which is basically a portable version of WebView2
* using both latest stable version of Microsoft.Web.View2.Core.dll from NuGet which is 1.0.705.50 and latest pre-release version
* using both Log.entryAdded event and Console.messageAdded (deprecated)
* subscribing to the event after I open the DevTools window

So what am I doing wrong?