Skip to content

[Problem/Bug]: NavigationCompleted report fail when download a file #5172

@HO-COOH

Description

@HO-COOH

What happened?

NavigationCompleted event handler reports navigation failed when clicking on a file download link, while the HttpStatusCode is 0. This behavior is not documented anywhere.

This is a blocking issue, as I cannot differentiate whether the navigation is failed due to network error (I tried disconnect ethernet, it will be the same status code) or a file download.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 11

OS Version

No response

Repro steps

Use the official C++ win32 getting start project,
add this event handler

EventRegistrationToken token;
webview->add_NavigationCompleted(Callback<ICoreWebView2NavigationCompletedEventHandler>(
	[](ICoreWebView2* webview, ICoreWebView2NavigationCompletedEventArgs* args) -> HRESULT {
		BOOL isSuccess = true;
		args->get_IsSuccess(&isSuccess);
		if (!isSuccess)
		{
			MessageBox(NULL, L"Failed", L"", NULL);
		}
		return S_OK;
	}).Get(), &token);

Navigate to the download page, like https://developer.microsoft.com/en-us/microsoft-edge/webview2
download a file, then the message box shows.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions