Skip to content

[Windows] Fix WebView rendering alongside HybridWebView - #39512

Merged
kubaflo merged 1 commit into
dotnet:inflight/currentfrom
sheiksyedm:sheiksyedm-webview-coexistence-fix
Oct 21, 2026
Merged

kubaflo merged 1 commit into
dotnet:inflight/currentfrom
sheiksyedm:sheiksyedm-webview-coexistence-fix

Conversation

@sheiksyedm

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

On Windows, a regular WebView renders blank when used alongside a HybridWebView. This regression was originally reported in #34558 and reported again in #39297 after the previous fix, #35092, was reverted by #35814 because of HybridWebView device-test failures in CI.

The reported two-window scenario was reproduced in Sandbox using local HTML to avoid network dependencies. In both initialization orders, the first control loaded successfully while the second failed WebView2 initialization with COMException 0x8007139F.

Root Cause

WinUI initializes its default WebView2 environment with Language set to the first entry in Windows.Globalization.ApplicationLanguages.Languages. HybridWebView creates an explicit environment without applying the same language default.

WebView2 controls sharing a user data folder require compatible browser-process environment options. The different language defaults make these environments incompatible, preventing the second control from initializing.

Fix Details

Apply WinUI's application-language default when the HybridWebView environment language is unspecified.

  • Preserve explicitly configured environment languages.
  • Preserve custom user data folders, profiles, and other environment/controller settings.
  • Retain a single explicit environment/controller initialization path.
  • Leave regular WebView initialization and non-Windows implementations unchanged.

Unlike the reverted fix, this does not switch between default and explicit initialization depending on whether settings are customized. It resolves the underlying language mismatch for both default and customized initialization.

Validation

Added focused Windows device tests covering:

  • Default coexistence in both initialization orders.
  • Coexistence with a custom HybridWebView profile.
  • Coexistence with explicitly supplied environment options whose language is unspecified.
  • Preservation of an explicitly configured language.

Issues Fixed

Fixes #34558
Fixes #39297

Match WinUI's default WebView2 environment language while preserving explicit language and controller settings. Add focused Windows device tests for coexistence and custom language preservation.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 08:40
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39512

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39512"

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 21, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Windows device-test results remain unverified, and the previous fix was reverted after CI failures.

No open issues 🎉

What changed in this PR

Addresses blank Windows WebViews alongside HybridWebView by aligning their default WebView2 environment languages.

Changes:

  • Apply the application language when HybridWebView has no explicit language.
  • Preserve custom settings and the existing initialization path.
  • Add Windows tests for coexistence and explicit-language preservation.
File Description
src/​Core/​src/​Handlers/​HybridWebView/​HybridWebViewHandler.Windows.cs Aligns the default environment language with WinUI.
src/​Controls/​tests/​DeviceTests/​Elements/​HybridWebView/​HybridWebViewTests_Initialization.Windows.cs Tests preservation of an explicit language.
src/​Controls/​tests/​DeviceTests/​Elements/​HybridWebView/​HybridWebViewTests_Coexistence.Windows.cs Tests both initialization orders and customized settings.

Review effort: Balanced

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 21, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo changed the base branch from main to inflight/current October 21, 2026 17:00
@kubaflo
kubaflo merged commit 122319e into dotnet:inflight/current Oct 21, 2026
202 of 213 checks passed
kubaflo pushed a commit that referenced this pull request Oct 25, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->


### Issue Details

On Windows, a regular WebView renders blank when used alongside a
HybridWebView. This regression was originally reported in
#34558 and reported again in #39297 after the
previous fix, #35092, was reverted by #35814
because of HybridWebView device-test failures in CI.

The reported two-window scenario was reproduced in Sandbox using local
HTML to avoid network dependencies. In both initialization orders, the
first control loaded successfully while the second failed WebView2
initialization with COMException `0x8007139F`.

### Root Cause

WinUI initializes its default WebView2 environment with `Language` set
to the first entry in
`Windows.Globalization.ApplicationLanguages.Languages`. HybridWebView
creates an explicit environment without applying the same language
default.

WebView2 controls sharing a user data folder require compatible
browser-process environment options. The different language defaults
make these environments incompatible, preventing the second control from
initializing.

### Fix Details

Apply WinUI's application-language default when the HybridWebView
environment language is unspecified.

- Preserve explicitly configured environment languages.
- Preserve custom user data folders, profiles, and other
environment/controller settings.
- Retain a single explicit environment/controller initialization path.
- Leave regular WebView initialization and non-Windows implementations
unchanged.

Unlike the reverted fix, this does not switch between default and
explicit initialization depending on whether settings are customized. It
resolves the underlying language mismatch for both default and
customized initialization.

#### Validation

Added focused Windows device tests covering:

- Default coexistence in both initialization orders.
- Coexistence with a custom HybridWebView profile.
- Coexistence with explicitly supplied environment options whose
language is unspecified.
- Preservation of an explicitly configured language.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #34558
Fixes #39297

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Oct 26, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->


### Issue Details

On Windows, a regular WebView renders blank when used alongside a
HybridWebView. This regression was originally reported in
#34558 and reported again in #39297 after the
previous fix, #35092, was reverted by #35814
because of HybridWebView device-test failures in CI.

The reported two-window scenario was reproduced in Sandbox using local
HTML to avoid network dependencies. In both initialization orders, the
first control loaded successfully while the second failed WebView2
initialization with COMException `0x8007139F`.

### Root Cause

WinUI initializes its default WebView2 environment with `Language` set
to the first entry in
`Windows.Globalization.ApplicationLanguages.Languages`. HybridWebView
creates an explicit environment without applying the same language
default.

WebView2 controls sharing a user data folder require compatible
browser-process environment options. The different language defaults
make these environments incompatible, preventing the second control from
initializing.

### Fix Details

Apply WinUI's application-language default when the HybridWebView
environment language is unspecified.

- Preserve explicitly configured environment languages.
- Preserve custom user data folders, profiles, and other
environment/controller settings.
- Retain a single explicit environment/controller initialization path.
- Leave regular WebView initialization and non-Windows implementations
unchanged.

Unlike the reverted fix, this does not switch between default and
explicit initialization depending on whether settings are customized. It
resolves the underlying language mismatch for both default and
customized initialization.

#### Validation

Added focused Windows device tests covering:

- Default coexistence in both initialization orders.
- Coexistence with a custom HybridWebView profile.
- Coexistence with explicitly supplied environment options whose
language is unspecified.
- Preservation of an explicitly configured language.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #34558
Fixes #39297

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
github-actions Bot pushed a commit that referenced this pull request Oct 28, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->


### Issue Details

On Windows, a regular WebView renders blank when used alongside a
HybridWebView. This regression was originally reported in
#34558 and reported again in #39297 after the
previous fix, #35092, was reverted by #35814
because of HybridWebView device-test failures in CI.

The reported two-window scenario was reproduced in Sandbox using local
HTML to avoid network dependencies. In both initialization orders, the
first control loaded successfully while the second failed WebView2
initialization with COMException `0x8007139F`.

### Root Cause

WinUI initializes its default WebView2 environment with `Language` set
to the first entry in
`Windows.Globalization.ApplicationLanguages.Languages`. HybridWebView
creates an explicit environment without applying the same language
default.

WebView2 controls sharing a user data folder require compatible
browser-process environment options. The different language defaults
make these environments incompatible, preventing the second control from
initializing.

### Fix Details

Apply WinUI's application-language default when the HybridWebView
environment language is unspecified.

- Preserve explicitly configured environment languages.
- Preserve custom user data folders, profiles, and other
environment/controller settings.
- Retain a single explicit environment/controller initialization path.
- Leave regular WebView initialization and non-Windows implementations
unchanged.

Unlike the reverted fix, this does not switch between default and
explicit initialization depending on whether settings are customized. It
resolves the underlying language mismatch for both default and
customized initialization.

#### Validation

Added focused Windows device tests covering:

- Default coexistence in both initialization orders.
- Coexistence with a custom HybridWebView profile.
- Coexistence with explicitly supplied environment options whose
language is unspecified.
- Preservation of an explicitly configured language.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #34558
Fixes #39297

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 6885c700 Deployed Oct 21, 2026 by sheiksyedm via conclusion #2422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-hybridwebview HybridWebView control area-controls-webview WebView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows s/agent-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] the Webview control doesn't render and just show the window background [Windows] WebView Regression from NET9 to NET10

3 participants