Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WebView2 ERR_NAME_NOT_RESOLVED when mapping foldersΒ #21733

@lucaregini

Description

@lucaregini

Current behavior πŸ›

Using Uno SDK version 6.4.0-dev.50.
Webview2 is not able to load the mapped urls and returns a ERR_NAME_NOT_RESOLVED.
It seems this is due to EnsureCoreWebView2Async not really completing the initialization of view. In fact given this code:

await MyWebView.EnsureCoreWebView2Async();
//await Task.Delay(1000);
var folder = Path.Combine(AppContext.BaseDirectory, "Assets");
MyWebView.CoreWebView2.SetVirtualHostNameToFolderMapping(
"appassets.local",
folder,
CoreWebView2HostResourceAccessKind.Allow);

MyWebView.Source = new Uri("https://appassets.local/testpage.html");

The webview loads correctly when uncommeting the one second delay while it doesn't work otherwise.

Expected behavior 🎯

Webview loads correctly

How to reproduce it (as minimally and precisely as possible) πŸ”¬

Use webview2 with the sdk version in the description. Map a folder and load a page from the mapped folder.

Workaround πŸ› οΈ

NA

Renderer 🎨

  • Skia
  • Native

Affected platforms πŸ“±πŸ’»πŸ–₯️

Windows

Uno.Sdk version (and other relevant versions) πŸ“¦

6.4.0-dev.50.

IDE version πŸ§‘β€πŸ’»

Microsoft Visual Studio Enterprise 2022 (2) (64 bit) - Current
Version 17.14.18 (October 2025)

Anything else we need to know? πŸ’¬

Found Edge WebView2 version 141.0.3537.99

Metadata

Metadata

Labels

difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.triage/untriagedIndicates an issue requires triaging or verification

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions