MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
444 stars 53 forks source link

No page content displayed, following simple documentation #2223

Closed ygoe closed 2 years ago

ygoe commented 2 years ago

Description I followed this documentation. I created a new WPF project for .NET Core 3.1 in VS 2019. After installing the NuGet package, the app started, so the web view control should work. But after adding it to my main window inside the default <Grid>, the window remains white when I run the app. As if the web view wasn't there at all. No context menu no drawn pixels. Only in the VS designer preview, there's the text "WebView2" that indicated that the control should cover the entire window.

Version SDK: unknown Runtime: Edge Version 98.0.1108.56 (Offizielles Build) (64-Bit) Framework: WPF OS: Windows 10 Pro 21H2

Repro Steps Follow documentation steps

Screenshots Empty WPF window

Additional context None

mmcer commented 2 years ago

I also can reproduce this issue. Microsoft.Web.WebView2 Nuget: 1.0.1158-prerelease and 1.0.1108.44 both failed Platform: WPF OS: win10 Pro 21H2(19044.1526) and win11 Pro 21H2(22000.527) both failed

the same code works before, so i guess maybe Edge runtime, or OS hotfix not compatible with this control

champnic commented 2 years ago

If you listen to the WebView2.CoreWebView2InitializationCompleted event, is args.IsSuccess true? If not, what is the args.InitializationException?

ygoe commented 2 years ago

It's false. The exception text says: "Couldn't find a compatible Webview2 Runtime installation to host WebViews."

There is an inner exception: "Cannot find the file." But as it is with FileNotFoundException, it won't tell me what it was looking for.

I've installed the Edge browser that comes with Windows, but I don't use it. Its version is: Version 98.0.1108.62 (Offizielles Build) (64-Bit)

champnic commented 2 years ago

You need to specifically install the WebView2 Runtime. The stable Microsoft Edge browser cannot be used to support WebView2. https://developer.microsoft.com/en-us/microsoft-edge/webview2/ https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution

Thanks!