WebView2 control unable to render html

Viewed 829

I'm testing WebView2 (1.0.774.44) to see if it can replace old IE embedded web browser for my wpf project. What I'm doing is simply navigate to wherever the domain I hardcoded. And it works fine on my Dev environment. But when I test my app (the same .exe) on one of my virtual machines, it does not work.

On the testing environment, the web viewer only displays blank pages. When I run DevTools on the page, it looks like it loads html strings. I can even click links or buttons on the page. I just cannot see them.

There are not much to share either. I just simply made a new window that is declared like below.

//TestWebViewWindow.xaml
<window 
...some declarations
    xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
...more declarations
>

    <Border>
        <wv2:WebView2 Name="xWebView" Source="https://microsoft.com">
            <wv2:WebView2.CreationProperties>
                <wv2:CoreWebView2CreationProperties UserDataFolder="C:\Temp\webview2"/>
            </wv2:WebView2.CreationProperties>
        </wv2:WebView2>
    </Border>
</window>

At first, I thought it was a browser problem but then the problem persisted on my testing VM, even when I installed the latest compatible Webview2 Runtime.

Both of my testing and dev environment have WebView2 Runtime (89.0.774.68) installed. And I have copied WebView2Loader.dll on the testing environment.

Any guidance?

EDIT: I have not tried Disabling one of Display adapter, but unfortunately, that option is not a way I'm trying to pursue. What I found so far is that, stated problem does not seem to reproduce on latest release of Windows 10.

2 Answers

The same problem here, Finally I found a solution by disabling one of my display adapters and changing the main display in Windows settings.

As a less aggressive method, you can also try to change the main monitor on Windows

It's completely odd but it's working now.

We experienced a similar issue and finally discovered that it could reproduce only whenever we worked with more than one graphics card adapter. Perhaps it's also your case.

Related