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

Skip to content

Conversation

@morning4coffe-dev
Copy link
Member

GitHub Issue: closes #22115

PR Type:

  • 🐞 Bugfix

What is the current behavior? πŸ€”

What is the new behavior? πŸš€

PR Checklist βœ…

Please check if your PR fulfills the following requirements:

Other information ℹ️

Copilot AI review requested due to automatic review settings December 14, 2025 14:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in WebView2 where calling ToString() on a relative URI causes an InvalidOperationException. The fix updates the code to use AbsoluteUri for absolute URIs and OriginalString for relative URIs, ensuring proper handling of both URI types when navigating.

Key Changes:

  • Updated URI-to-string conversion logic to check IsAbsoluteUri before deciding between AbsoluteUri and OriginalString
  • Applied the fix consistently across WebView2 property changed handler and CoreWebView2 navigation methods

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/WebView2.Properties.cs Updated Source property changed handler to handle both absolute and relative URIs by checking IsAbsoluteUri before converting to string
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2.cs Applied the same URI handling logic to Navigate and NavigateWithHttpRequestMessage methods for consistency

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22136/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22136/docs/index.html

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22136/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22136/docs/index.html

Copy link
Contributor

@ajpinedam ajpinedam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. Could a test be added to validate this new behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebView2] WebView2 SourceProperty uses Uri.ToString(): potential Bug source and pre-escaping expectations for consumers missing in Docs

4 participants