microsoft / microsoft/microsoft-ui-xaml

WebView2 reports navigation failure for URLs with non-Western characters despite successful page load

Open
#10,339 0 comments 1 reaction 0 assignees View on GitHub
area-WebView bug
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

When using WebView2 in a WinUI 3 application, the NavigationCompleted event reports a failure (IsSuccess = false) for URLs containing encoded non-Western characters, even though the webpage loads successfully. This inconsistency between the reported navigation status and the actual page load state can lead to incorrect error handling in applications relying on the NavigationCompleted event.

### Steps to reproduce the bug

1. Download and open the attached WinUI 3 sample project in Visual Studio 2022. [winui3.zip](https://github.com/user-attachments/files/18748460/winui3.zip)
2. Build and run the application.
3. Observe that the WebView2 control loads and displays the webpage correctly.
4. Check the Output window in Visual Studio (View -> Output or Ctrl+Alt+O) and select "Debug" in the dropdown.
5. Note that the debug statement logs "Navigation failed with error: Unknown" due to IsSuccess being false in the NavigationCompleted event, even though the webpage loads properly.

### Expected behavior

The NavigationCompleted event should have IsSuccess as true since the webpage loads correctly in WebView2.

### Screenshots

![Image](https://github.com/user-attachments/assets/c160415f-4eec-4d97-9924-c45dfc6205d0)

### NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

### Windows version

Windows 11 (23H2): Build 22631

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the attached winui3.zip sample in Visual Studio 2022 and reproduce the behavior using the Output window's Debug output. Verify the NavigationCompleted event for URLs with encoded non-Western characters and determine whether completion can report success when the page loads successfully; done means the reported status matches the actual load state.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.