[release/10.0.1xx-sr7] [Windows] Fix WebView blank rendering when used with HybridWebView#35585
Conversation
…35092) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you!<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses an issue where the `WebView` rendered blank when both a `HybridWebView` and a regular `WebView` coexisted in the same Windows (UWP) app. The main fix ensures that `HybridWebView` only creates a custom `CoreWebView2Environment` if custom settings are provided, allowing both controls to share the default environment and preventing conflicts. Additionally, new test cases have been added to verify the fix. ### Description of Change **Bug fix for WebView and HybridWebView coexistence:** * Updated `HybridWebViewHandler.Windows.cs` so that a custom `CoreWebView2Environment` is created only if the user provides custom settings; otherwise, the default shared environment is used. This prevents conflicts when both `HybridWebView` and `WebView` are present in the same app, resolving the blank rendering issue. [[1]](diffhunk://#diff-9adaedb7571e93283664d8e3db8d34930d748bbe1207eb004f53e25e08eaaaeaR310-R325) [[2]](diffhunk://#diff-9adaedb7571e93283664d8e3db8d34930d748bbe1207eb004f53e25e08eaaaeaR337-R341) **Test coverage improvements:** * Added a new UI test in `TestCases.Shared.Tests/Tests/Issues/Issue34558.cs` to verify that the regular `WebView` renders content successfully when coexisting with a `HybridWebView`. * Introduced a new test case page in `TestCases.HostApp/Issues/Issue34558.cs` that sets up both controls and provides UI elements for automated verification. <!-- Enter description of the fix in this section --> ### 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 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/4ba3435a-99af-4e7e-82be-6dbb588e07b6"> | <video src="https://github.com/user-attachments/assets/fb5b1e22-b317-4421-829c-0f9b15c84e77"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35585Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35585" |
|
/review -b feature/refactor-copilot-yml |
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
🤖 AI Summary
📊 Review Session —
|
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue34558 Issue34558 |
✅ FAIL — 489s | ✅ PASS — 468s |
🔴 Without fix — 🖥️ Issue34558: FAIL ✅ · 489s
Determining projects to restore...
Restored D:\a\1\s\src\Graphics\src\Graphics.Win2D\Graphics.Win2D.csproj (in 1.05 sec).
Restored D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj (in 1.05 sec).
Restored D:\a\1\s\src\Essentials\src\Essentials.csproj (in 153 ms).
Restored D:\a\1\s\src\Core\src\Core.csproj (in 305 ms).
Restored D:\a\1\s\src\Core\maps\src\Maps.csproj (in 189 ms).
Restored D:\a\1\s\src\Controls\src\Xaml\Controls.Xaml.csproj (in 140 ms).
Restored D:\a\1\s\src\Controls\src\Xaml.Design\Controls.Xaml.Design.csproj (in 12 ms).
Restored D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj (in 72 ms).
Restored D:\a\1\s\src\Controls\src\Core.Design\Controls.Core.Design.csproj (in 4 ms).
Restored D:\a\1\s\src\Controls\src\BindingSourceGen\Controls.BindingSourceGen.csproj (in 25 ms).
Restored D:\a\1\s\src\Controls\Maps\src\Controls.Maps.csproj (in 67 ms).
Restored D:\a\1\s\src\Controls\Foldable\src\Controls.Foldable.csproj (in 59 ms).
Restored D:\a\1\s\src\BlazorWebView\src\Maui\Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 103 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj (in 1.21 sec).
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics.Win2D -> D:\a\1\s\artifacts\bin\Graphics.Win2D\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Maps -> D:\a\1\s\artifacts\bin\Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Maps.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Foldable -> D:\a\1\s\artifacts\bin\Controls.Foldable\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Foldable.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Maps -> D:\a\1\s\artifacts\bin\Controls.Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Maps.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Microsoft.AspNetCore.Components.WebView.Maui -> D:\a\1\s\artifacts\bin\Microsoft.AspNetCore.Components.WebView.Maui\Debug\net10.0-windows10.0.19041.0\Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Xaml -> D:\a\1\s\artifacts\bin\Controls.Xaml\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Xaml.dll
Controls.TestCases.HostApp -> D:\a\1\s\artifacts\bin\Controls.TestCases.HostApp\Debug\net10.0-windows10.0.19041.0\win-x64\Controls.TestCases.HostApp.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:05:36.79
Determining projects to restore...
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj (in 558 ms).
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj (in 558 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Core\UITest.Core.csproj (in 12 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.NUnit\UITest.NUnit.csproj (in 36 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Appium\UITest.Appium.csproj (in 23 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Analyzers\UITest.Analyzers.csproj (in 68 ms).
Restored D:\a\1\s\src\Controls\tests\CustomAttributes\Controls.CustomAttributes.csproj (in 7 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj (in 78 ms).
7 of 15 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 5/24/2026 3:23:46 PM FixtureSetup for Issue34558(Windows)
>>>>> 5/24/2026 3:23:56 PM WebViewLoadsWhenCoexistingWithHybridWebView Start
>>>>> 5/24/2026 3:24:02 PM WebViewLoadsWhenCoexistingWithHybridWebView Stop
>>>>> 5/24/2026 3:24:02 PM Log types:
>>>>> 5/24/2026 3:24:04 PM FixtureSetup for WebViewLoadsWhenCoexistingWithHybridWebView
>>>>> 5/24/2026 3:24:12 PM Log types:
Failed WebViewLoadsWhenCoexistingWithHybridWebView [19 s]
Error Message:
The app was expected to be running still, investigate as possible crash
TearDown : The app was expected to be running still, investigate as possible crash
Stack Trace:
at UITest.Appium.NUnit.UITestBase.UITestBaseTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 159
at UITest.Appium.NUnit.UITestBase.TestTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 45
--TearDown
at UITest.Appium.NUnit.UITestBase.UITestBaseTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 159
at UITest.Appium.NUnit.UITestBase.TestTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 45
1) at UITest.Appium.NUnit.UITestBase.UITestBaseTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 159
at UITest.Appium.NUnit.UITestBase.TestTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 45
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.11] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.31] Discovered: Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
Total tests: 1
Failed: 1
Test Run Failed.
Total time: 41.4023 Seconds
>>> TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
🟢 With fix — 🖥️ Issue34558: PASS ✅ · 468s
Determining projects to restore...
Restored D:\a\1\s\src\Controls\src\Xaml.Design\Controls.Xaml.Design.csproj (in 647 ms).
Restored D:\a\1\s\src\Controls\src\Core.Design\Controls.Core.Design.csproj (in 5 ms).
Restored D:\a\1\s\src\Controls\src\BindingSourceGen\Controls.BindingSourceGen.csproj (in 28 ms).
Restored D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj (in 867 ms).
Restored D:\a\1\s\src\Controls\Maps\src\Controls.Maps.csproj (in 147 ms).
Restored D:\a\1\s\src\Controls\Foldable\src\Controls.Foldable.csproj (in 57 ms).
Restored D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj (in 48 ms).
Restored D:\a\1\s\src\BlazorWebView\src\Maui\Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 132 ms).
Restored D:\a\1\s\src\Graphics\src\Graphics.Win2D\Graphics.Win2D.csproj (in 12 ms).
Restored D:\a\1\s\src\Essentials\src\Essentials.csproj (in 42 ms).
Restored D:\a\1\s\src\Core\src\Core.csproj (in 80 ms).
Restored D:\a\1\s\src\Core\maps\src\Maps.csproj (in 57 ms).
Restored D:\a\1\s\src\Controls\src\Xaml\Controls.Xaml.csproj (in 65 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj (in 842 ms).
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Essentials.dll
Graphics.Win2D -> D:\a\1\s\artifacts\bin\Graphics.Win2D\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.dll
Maps -> D:\a\1\s\artifacts\bin\Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Maps.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Controls.Maps -> D:\a\1\s\artifacts\bin\Controls.Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Maps.dll
Controls.Foldable -> D:\a\1\s\artifacts\bin\Controls.Foldable\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Foldable.dll
Microsoft.AspNetCore.Components.WebView.Maui -> D:\a\1\s\artifacts\bin\Microsoft.AspNetCore.Components.WebView.Maui\Debug\net10.0-windows10.0.19041.0\Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Xaml -> D:\a\1\s\artifacts\bin\Controls.Xaml\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Xaml.dll
Controls.TestCases.HostApp -> D:\a\1\s\artifacts\bin\Controls.TestCases.HostApp\Debug\net10.0-windows10.0.19041.0\win-x64\Controls.TestCases.HostApp.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:05:36.14
Determining projects to restore...
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj (in 550 ms).
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj (in 550 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Core\UITest.Core.csproj (in 14 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.NUnit\UITest.NUnit.csproj (in 20 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Appium\UITest.Appium.csproj (in 14 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Analyzers\UITest.Analyzers.csproj (in 62 ms).
Restored D:\a\1\s\src\Controls\tests\CustomAttributes\Controls.CustomAttributes.csproj (in 8 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj (in 60 ms).
7 of 15 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 5/24/2026 3:31:54 PM FixtureSetup for Issue34558(Windows)
>>>>> 5/24/2026 3:32:03 PM WebViewLoadsWhenCoexistingWithHybridWebView Start
>>>>> 5/24/2026 3:32:06 PM WebViewLoadsWhenCoexistingWithHybridWebView Stop
Passed WebViewLoadsWhenCoexistingWithHybridWebView [2 s]
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.11] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.30] Discovered: Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 24.8302 Seconds
>>> TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
📁 Fix files reverted (41 files)
eng/Versions.propseng/pipelines/ci-copilot.ymlsrc/Compatibility/Core/src/Android/CollectionView/TemplatedItemViewHolder.cssrc/Compatibility/Core/src/Windows/CollectionView/ItemContentControl.cssrc/Compatibility/Core/src/iOS/CollectionView/TemplatedCell.cssrc/Compatibility/Core/src/iOS/Renderers/UIContainerCell.cssrc/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutRecyclerAdapter.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/iOS/UIContainerCell.cssrc/Controls/src/Core/FlyoutPage/FlyoutPage.cssrc/Controls/src/Core/Handlers/Items/Android/ItemContentView.cssrc/Controls/src/Core/Handlers/Items/Android/MauiRecyclerView.cssrc/Controls/src/Core/Handlers/Items/Android/TemplatedItemViewHolder.cssrc/Controls/src/Core/Handlers/Items/Tizen/ItemTemplateAdaptor.cssrc/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cssrc/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cssrc/Controls/src/Core/Handlers/Shell/Windows/ShellFlyoutItemView.cssrc/Controls/src/Core/IndicatorView/IndicatorStackLayout.cssrc/Controls/src/Core/NavigationPage/NavigationPage.cssrc/Controls/src/Core/NavigationPage/NavigationPageToolbar.cssrc/Controls/src/Core/Page/Page.cssrc/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cssrc/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cssrc/Controls/src/Core/Shell/Shell.cssrc/Controls/src/Core/VisualElement/VisualElement.cssrc/Controls/src/Core/VisualStateManager.cssrc/Controls/src/Core/Window/Window.Android.cssrc/Controls/src/Core/Window/Window.cssrc/Controls/src/Xaml/ApplyPropertiesVisitor.cssrc/Controls/src/Xaml/MarkupExtensions/StaticResourceExtension.cssrc/Core/src/Graphics/MauiDrawable.Android.cssrc/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cssrc/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cssrc/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cssrc/Core/src/Hosting/LifecycleEvents/AppHostBuilderExtensions.Android.cssrc/Core/src/Platform/Android/MauiAppCompatActivity.Lifecycle.cssrc/Core/src/Platform/Android/MauiAppCompatActivity.cssrc/SingleProject/Resizetizer/src/SkiaSharpSvgTools.cs
New files (not reverted):
src/Core/src/Platform/Android/IBackNavigationState.cs
🧪 UI Tests — ViewBaseTests,WebView
Detected UI test categories: ViewBaseTests,WebView
❌ Deep UI tests — 160 passed, 1 failed across 2 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
ViewBaseTests |
115/115 ✓ | — |
WebView |
45/46 (1 ❌) | 1 diff PNG |
❌ WebView — 1 failed test
VerifyHybridWebViewWithShadow
VisualTestUtils.VisualTestFailedException :
Snapshot different than baseline: VerifyHybridWebViewWithShadow.png (0.62% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.
More info: https://aka.ms/visual-test-workflow
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance, Boolean includeTitleBar) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 296
at Microsoft.Maui.TestCases.Tests.HybridWebViewFeatureTests.VerifyHybridWebViewWithShadow() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/HybridWebViewFeatureTests.cs:line 126
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.RuntimeMethodInfo.Invoke(Ob
...
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)
🔍 Regression Cross-Reference
🔍 Regression Cross-Reference
🟢 No regression risks detected. No labeled bug-fix PRs in the last 6 months touched the modified files.
🔍 Pre-Flight — Context & Validation
Issue: #34558 - [Windows] WebView Regression from NET9 to NET10
PR: #35585 - [release/10.0.1xx-sr7] [Windows] Fix WebView blank rendering when used with HybridWebView
Platforms Affected: Windows
Files Changed: 1 implementation, 2 test
Key Findings
- Issue [Windows] WebView Regression from NET9 to NET10 #34558 is a Windows regression from .NET 9 to .NET 10 where a regular WebView renders blank or crashes when a HybridWebView is initialized in the same app, especially with HybridWebView in the main window and WebView in an additional window.
- PR [release/10.0.1xx-sr7] [Windows] Fix WebView blank rendering when used with HybridWebView #35585 is a backport of merged PR [Windows] Fix WebView blank rendering when used with HybridWebView #35092 and changes
HybridWebViewHandler.Windows.csto use the default shared WebView2 environment when no custom initialization settings are supplied. - Gate was already completed separately and passed: the Issue34558 UI test fails without the fix and passes with the PR fix. Gate output was not regenerated.
- Prior review feedback on [Windows] Fix WebView blank rendering when used with HybridWebView #35092 focused on test fidelity/noise: HybridWebView default file missing, non-zero height assertion weakness, and original repro being multi-window while the test uses one page.
Code Review Summary
Verdict: NEEDS_DISCUSSION
Confidence: medium
Errors: 0 | Warnings: 1 | Suggestions: 0
Key code review findings:
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs:320Controller-only customizations (ScriptLocale,ProfileName,IsInPrivateModeEnabled) still force creation of a custom environment with the default user data folder, which may preserve a variant of the same environment-sharing conflict.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #35585 | Use EnsureCoreWebView2Async() with the default shared environment when HybridWebView initialization args have no custom settings; create a custom environment/options only when customization is present. |
PASSED (Gate) | src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs |
Original PR/backport of #35092 |
🔬 Code Review — Deep Analysis
Code Review PR #35585
Independent Assessment
What this changes: Windows HybridWebView now avoids creating an explicit CoreWebView2Environment when initialization args are all default, letting it share WebView2's default environment with regular WebView. It also adds a Windows UI regression test.
Inferred motivation: Avoid WebView2 environment/user-data-folder conflicts when HybridWebView and WebView coexist.
Reconciliation with PR Narrative
Author claims: Backport of #35092 fixing blank regular WebView rendering when used with HybridWebView.
Agreement/disagreement: The code matches the stated default-environment fix. Issue #34558 points to the same regression source. No existing review comments to duplicate. CI check runs are successful.
Findings
Warning Controller-only customizations still force the custom-environment path
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs:320
If an app sets only ScriptLocale, ProfileName, or IsInPrivateModeEnabled, hasCustomSettings becomes true and the code still creates a separate CoreWebView2Environment with the default user data folder before calling EnsureCoreWebView2Async(env, options). That appears to preserve the same environment-sharing conflict this PR fixes for the no-customization case.
If WebView2 requires this path for controller options, the limitation should be intentional/documented; otherwise consider using an overload/pattern that applies controller options without creating a conflicting default-folder environment, or require a distinct UserDataFolder for these options.
Devil's Advocate
The main reported scenario uses default initialization and is fixed. The warning affects only apps using Windows-specific controller options, so it may be an acceptable limitation or WebView2 API constraint. I did not find evidence in the PR explaining that tradeoff.
Verdict: NEEDS_DISCUSSION
Confidence: medium
Summary: The targeted regression fix looks sound and CI is green. I'd like clarification on the controller-options path before calling this fully ready, because it may leave a variant of the same WebView2 environment conflict unresolved.
🔧 Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Environment-only gate: create a custom CoreWebView2Environment only for environment-level settings, not controller-only options. | PASS | 1 file | Addresses controller-only conflict risk, but drops controller-only options unless env settings are also supplied. |
| 2 | try-fix | Isolated HybridWebView default user-data folder. | PASS (reported; artifact partial) | 1 file | Avoids conflict structurally, but changes storage/cache/cookie location. |
| 3 | try-fix | Shared cached explicit default environment for controller-only HybridWebView settings. | PASS | 1 file | Preserves controller options, but the tested path does not exercise controller-only settings and regular WebView still uses implicit default. |
| 4 | try-fix | Borrow implicit default environment from a transient WebView2 and use it for HybridWebView options. | PASS | 1 file | Avoids storage change but adds transient WebView2 startup/lifecycle overhead. |
| 5 | try-fix + cross-pollination | Shared explicit WebView2 environment provider used by both MauiWebView and HybridWebView. | PASS | 2 files | Most robust alternative; addresses implicit-vs-explicit mismatch and controller-only options, but has broader WebView blast radius. |
| PR | PR #35585 | Use parameterless EnsureCoreWebView2Async when no custom settings are supplied; otherwise create custom environment/options. | PASSED (Gate) | 1 implementation + 2 tests | Minimal servicing-branch fix; code review noted possible controller-only variant. |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| claude-opus-4.6 | 1 | Yes | Shared explicit CoreWebView2Environment used by both regular WebView and HybridWebView. |
| claude-opus-4.7 | 1 | Yes | Add MAUI Windows WebView2 environment provider shared by WebView and HybridWebView. |
| gpt-5.3-codex | 1 | Yes | Environment broker/shared provider with compatibility checks; isolate only incompatible cases. |
| gpt-5.5 | 1 | Yes | Static shared CoreWebView2Environment provider consumed by both MauiWebView and HybridWebView. |
| claude-opus-4.6 | 2 | No | Meaningful axes covered: gating, isolation, cached explicit default, borrowing implicit default, shared provider. |
| claude-opus-4.7 | 2 | No | Candidate 5 covers remaining implicit-vs-explicit and controller-options gaps. |
| gpt-5.3-codex | 2 | No | Further variants are hybrids; PR remains minimal-risk for servicing branch. |
| gpt-5.5 | 2 | No | Remaining fixes are variants of implicit default vs shared explicit default environment. |
Exhausted: Yes
Selected Fix: PR #35585 for the servicing backport it is the smallest blast-radius fix and already passed the gate. Candidate 5 is the strongest alternative product direction because it fixes the root implicit-vs-explicit mismatch for both WebView types and preserves controller-only options, but it is broader and not demonstrably safer for a servicing branch based on the single Issue34558 regression test.
try-fix-1
try-fix-1
Approach description
Approach: Environment-Only Gate (No Controller-Only Path)
Only create a custom CoreWebView2Environment when true environment-level settings
(BrowserExecutableFolder, UserDataFolder, EnvironmentOptions) are explicitly provided.
When none are set, call EnsureCoreWebView2Async() with no parameters to join the default
shared environment guaranteed compatible with regular WebView controls.
Controller-level options (ScriptLocale, ProfileName, IsInPrivateModeEnabled) are ONLY applied
when a custom environment is explicitly requested via environment-level settings.
Different from existing fix: The PR's hasCustomSettings check treats ALL 6 properties
(3 environment-level + 3 controller-level) as triggers for a custom environment. This approach
uses a narrower hasEnvironmentSettings check with only the 3 true environment-level properties.
This means controller-only customizations (ScriptLocale, ProfileName, IsInPrivateModeEnabled)
alone will NOT force the custom-environment path addressing the review concern that
controller-only settings still risk environment conflicts.
Trade-off: Users who set only ScriptLocale/ProfileName/IsInPrivateModeEnabled without also
setting UserDataFolder won't get those controller options applied. This is acceptable because
the default behavior (no environment conflict) is safer, and users who need controller options
can explicitly opt in by also providing a UserDataFolder.
First iteration (try-catch fallback) failed because the crash occurs in the regular WebView
control not in HybridWebView so catching exceptions in HybridWebView's init is ineffective.
Test results
Result: PASS
Relevant output:
Passed WebViewLoadsWhenCoexistingWithHybridWebView [2 s]
Test Run Successful.
Failure analysis
The first internal iteration tried a reactive try/catch fallback and failed because the crash happens in the regular WebView after HybridWebView creates an incompatible environment. The final environment-only gate passed.
Diff
diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
index f9cef27e49..e8d308ecbc 100644
--- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
@@ -307,17 +307,37 @@ namespace Microsoft.Maui.Handlers
var initializingArgs = new WebViewInitializationStartedEventArgs();
VirtualView?.WebViewInitializationStarted(initializingArgs);
- var env = await CoreWebView2Environment.CreateWithOptionsAsync(
- browserExecutableFolder: initializingArgs.BrowserExecutableFolder,
- userDataFolder: initializingArgs.UserDataFolder,
- options: initializingArgs.EnvironmentOptions);
+ // Only create a custom CoreWebView2Environment when environment-level settings are
+ // explicitly provided. Creating a separate environment (even with all-default settings)
+ // conflicts with other WebView2 controls (e.g., regular WebView) in the same app that
+ // use the default shared environment, because WebView2 requires all controls sharing
+ // the same user data folder to use compatible environments.
+ // Controller-level options (ScriptLocale, ProfileName, IsInPrivateModeEnabled) are only
+ // applied when a custom environment is created, since they require an environment to
+ // create CoreWebView2ControllerOptions from.
+ bool hasEnvironmentSettings =
+ initializingArgs.BrowserExecutableFolder != null ||
+ initializingArgs.UserDataFolder != null ||
+ initializingArgs.EnvironmentOptions != null;
+
+ if (hasEnvironmentSettings)
+ {
+ var env = await CoreWebView2Environment.CreateWithOptionsAsync(
+ browserExecutableFolder: initializingArgs.BrowserExecutableFolder,
+ userDataFolder: initializingArgs.UserDataFolder,
+ options: initializingArgs.EnvironmentOptions);
- var options = env.CreateCoreWebView2ControllerOptions();
- options.ScriptLocale = initializingArgs.ScriptLocale;
- options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled;
- options.ProfileName = initializingArgs.ProfileName;
+ var options = env.CreateCoreWebView2ControllerOptions();
+ options.ScriptLocale = initializingArgs.ScriptLocale;
+ options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled;
+ options.ProfileName = initializingArgs.ProfileName;
- await webView.EnsureCoreWebView2Async(env, options);
+ await webView.EnsureCoreWebView2Async(env, options);
+ }
+ else
+ {
+ await webView.EnsureCoreWebView2Async();
+ }
webView.CoreWebView2.Settings.AreDevToolsEnabled = Handler?.DeveloperTools.Enabled ?? false;
webView.CoreWebView2.Settings.IsWebMessageEnabled = true;
Analysis
Analysis
Result: Pass
What happened: The test WebViewLoadsWhenCoexistingWithHybridWebView passed the app did not
crash and the regular WebView successfully navigated and rendered content alongside the HybridWebView.
Iteration 1 (try-catch fallback) failed: The app still crashed because the environment conflict
causes the REGULAR WebView to crash (not the HybridWebView), so catching exceptions in HybridWebView
initialization is ineffective. This confirmed that the fix must PREVENT environment creation, not
react to it.
Iteration 2 (environment-only gate) passed: By only creating a custom CoreWebView2Environment when
true environment-level settings (BrowserExecutableFolder, UserDataFolder, EnvironmentOptions) are
provided, and using EnsureCoreWebView2Async() for the default case, the HybridWebView joins the
same shared environment as the regular WebView, eliminating the conflict.
Why it works: The root cause is that CoreWebView2Environment.CreateWithOptionsAsync(null, null, null)
creates an environment instance that is incompatible with the internally-created default environment
used by the WinUI WebView2 control. By not creating any explicit environment when settings are default,
both controls share the same implicit environment.
Self-review: 0 findings clean self-review.
Difference from PR's fix: The PR checks all 6 properties (3 environment-level + 3 controller-level)
in its hasCustomSettings condition. This fix uses a narrower hasEnvironmentSettings check with only
the 3 environment-level properties. The trade-off is that controller-only options (ScriptLocale,
ProfileName, IsInPrivateModeEnabled) won't be applied unless the user also provides an environment-level
setting. This directly addresses the code review concern that controller-only customizations still
force the custom-environment path in the PR's approach.
Insights:
- The crash occurs in the regular WebView, not the HybridWebView reactive approaches (try-catch)
in HybridWebView's init cannot work. - WebView2 environment compatibility is strictly enforced per user-data-folder even an environment
created with all-null defaults is incompatible with the implicit default environment.
try-fix-2
try-fix-2
Approach description
Isolated user-data-folder for HybridWebView. Always create a custom CoreWebView2Environment, but when the caller does not provide UserDataFolder, set one under %LocalAppData%/<AppName>/MauiHybridWebView. This changes the root-cause strategy from deciding when to create an environment to ensuring the HybridWebView custom environment does not share the regular WebView default user-data folder.
Test results
Result: PASS (reported by try-fix agent)
Reported output summary: Issue34558.WebViewLoadsWhenCoexistingWithHybridWebView passed on Windows (1/1).
Failure analysis
The first iteration hit a compile error because Windows.Storage.ApplicationData.Current was unavailable in this WinUI/Windows App SDK context. The attempt switched to Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) plus the entry assembly name and then passed.
Diff
The try-fix sub-agent reported CustomAgentLogsTmp/PRState/35585/PRAgent/try-fix/attempt-2/fix.diff, but that attempt directory was not persisted after the baseline restore. The effective diff was described as changing HybridWebViewHandler.Windows.cs so that a caller-supplied UserDataFolder is preserved, otherwise an app-local MauiHybridWebView folder is supplied before creating the CoreWebView2Environment.
Analysis
This is a valid alternative root-cause strategy and avoids implicit/default environment collision, but it changes HybridWebView storage/cache/cookie location for existing apps. Because the diff artifact was not persisted, this candidate is recorded as partial-evidence PASS rather than selected.
try-fix-3
Try-Fix Attempt 3 Narrative
Approach
Use a shared default CoreWebView2Environment only for controller-only HybridWebView initialization customizations (ScriptLocale, ProfileName, IsInPrivateModeEnabled), keep explicit custom environment creation for environment-level settings, and keep plain EnsureCoreWebView2Async() when no customization exists.
Why this is independent
- Not the PR fix: PR conditionally uses parameterless Ensure only when no args are customized, and otherwise creates per-invocation environment/options.
- Not Candidate 1: does not drop controller-only customizations.
- Not Candidate 2: does not isolate by assigning a distinct default user-data-folder.
Diff
`diff
diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
index f9cef27e49..9c78bc52ae 100644
--- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
@@ -287,6 +287,9 @@ namespace Microsoft.Maui.Handlers
#endif
private sealed class HybridWebView2Proxy
{
-
private static readonly object s_defaultEnvironmentLock = new(); -
private static Task<CoreWebView2Environment>? s_defaultEnvironmentTask; -
private WeakReference<Window>? _window; private WeakReference<HybridWebViewHandler>? _handler;
@@ -307,17 +310,41 @@ namespace Microsoft.Maui.Handlers
var initializingArgs = new WebViewInitializationStartedEventArgs();
VirtualView?.WebViewInitializationStarted(initializingArgs);
-
var env = await CoreWebView2Environment.CreateWithOptionsAsync( -
browserExecutableFolder: initializingArgs.BrowserExecutableFolder, -
userDataFolder: initializingArgs.UserDataFolder, -
options: initializingArgs.EnvironmentOptions); -
var options = env.CreateCoreWebView2ControllerOptions(); -
options.ScriptLocale = initializingArgs.ScriptLocale; -
options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled; -
options.ProfileName = initializingArgs.ProfileName;
-
bool hasEnvironmentSettings = -
initializingArgs.BrowserExecutableFolder is not null || -
initializingArgs.UserDataFolder is not null || -
initializingArgs.EnvironmentOptions is not null; -
bool hasControllerSettings = -
!string.IsNullOrEmpty(initializingArgs.ScriptLocale) || -
initializingArgs.IsInPrivateModeEnabled || -
!string.IsNullOrEmpty(initializingArgs.ProfileName);
-
await webView.EnsureCoreWebView2Async(env, options);
-
if (hasEnvironmentSettings) -
{ -
var env = await CoreWebView2Environment.CreateWithOptionsAsync( -
browserExecutableFolder: initializingArgs.BrowserExecutableFolder, -
userDataFolder: initializingArgs.UserDataFolder, -
options: initializingArgs.EnvironmentOptions); -
var options = env.CreateCoreWebView2ControllerOptions(); -
options.ScriptLocale = initializingArgs.ScriptLocale; -
options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled; -
options.ProfileName = initializingArgs.ProfileName; -
await webView.EnsureCoreWebView2Async(env, options); -
} -
else if (hasControllerSettings) -
{ -
var env = await GetSharedDefaultEnvironmentAsync(); -
var options = env.CreateCoreWebView2ControllerOptions(); -
options.ScriptLocale = initializingArgs.ScriptLocale; -
options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled; -
options.ProfileName = initializingArgs.ProfileName; -
await webView.EnsureCoreWebView2Async(env, options); -
} -
else -
{ -
await webView.EnsureCoreWebView2Async(); -
} webView.CoreWebView2.Settings.AreDevToolsEnabled = Handler?.DeveloperTools.Enabled ?? false; webView.CoreWebView2.Settings.IsWebMessageEnabled = true;
@@ -334,6 +361,18 @@ namespace Microsoft.Maui.Handlers
return true;
}
-
private static Task<CoreWebView2Environment> GetSharedDefaultEnvironmentAsync() -
{ -
lock (s_defaultEnvironmentLock) -
{ -
s_defaultEnvironmentTask ??= CoreWebView2Environment.CreateWithOptionsAsync( -
browserExecutableFolder: null, -
userDataFolder: null, -
options: null).AsTask(); -
return s_defaultEnvironmentTask; -
} -
} -
private void OnWebResourceRequested(CoreWebView2 sender, CoreWebView2WebResourceRequestedEventArgs args) { Handler?.OnWebResourceRequested(sender, args);
`
Test results
Command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform windows -TestFilter "Issue34558"
Outcome: Pass
Relevant output:
Test Run Successful.
Passed: 1
Failure analysis
N/A (candidate passed).
try-fix-4
Try-Fix 4: Borrow Implicit Default Environment
Approach
Instead of creating a default CoreWebView2Environment with CreateWithOptionsAsync(null, null, null), this attempt creates a transient WebView2, initializes it using parameterless EnsureCoreWebView2Async(), and reuses the resulting implicit default environment for the real HybridWebView. Environment-level customizations still use CreateWithOptionsAsync; controller options are created from whichever environment is selected.
This differs from PR #35585 because the real HybridWebView is still initialized with an explicit environment/options pair, and it differs from prior candidates because it does not use an environment-only no-customization gate, an isolated default user-data folder, or a cached explicit default environment.
Diff
``diff
diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
index f9cef27e49..2688bc4647 100644
--- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
@@ -307,10 +307,7 @@ namespace Microsoft.Maui.Handlers
var initializingArgs = new WebViewInitializationStartedEventArgs();
VirtualView?.WebViewInitializationStarted(initializingArgs);
-
var env = await CoreWebView2Environment.CreateWithOptionsAsync( -
browserExecutableFolder: initializingArgs.BrowserExecutableFolder, -
userDataFolder: initializingArgs.UserDataFolder, -
options: initializingArgs.EnvironmentOptions);
-
var env = await GetCoreWebView2EnvironmentAsync(initializingArgs); var options = env.CreateCoreWebView2ControllerOptions(); options.ScriptLocale = initializingArgs.ScriptLocale;
@@ -334,6 +331,30 @@ namespace Microsoft.Maui.Handlers
return true;
}
-
private static async Task<CoreWebView2Environment> GetCoreWebView2EnvironmentAsync(WebViewInitializationStartedEventArgs initializingArgs) -
{ -
if (initializingArgs.BrowserExecutableFolder is not null || -
initializingArgs.UserDataFolder is not null || -
initializingArgs.EnvironmentOptions is not null) -
{ -
return await CoreWebView2Environment.CreateWithOptionsAsync( -
browserExecutableFolder: initializingArgs.BrowserExecutableFolder, -
userDataFolder: initializingArgs.UserDataFolder, -
options: initializingArgs.EnvironmentOptions); -
} -
var defaultWebView = new WebView2(); -
try -
{ -
await defaultWebView.EnsureCoreWebView2Async(); -
return defaultWebView.CoreWebView2.Environment; -
} -
finally -
{ -
defaultWebView.Close(); -
} -
} -
private void OnWebResourceRequested(CoreWebView2 sender, CoreWebView2WebResourceRequestedEventArgs args) { Handler?.OnWebResourceRequested(sender, args);
``
Test Results
Command:
powershell pwsh .github\scripts\BuildAndRunHostApp.ps1 -Platform windows -TestFilter "Issue34558"
Result: PASS one test discovered and WebViewLoadsWhenCoexistingWithHybridWebView passed.
` ext
╔═══════════════════════════════════════════════════════════╗
║ .NET MAUI HostApp Build and Test Script ║
║ Platform: WINDOWS ║
╚═══════════════════════════════════════════════════════════╝
?? Validating prerequisites...
?? Cleaned up 3 old log file(s) from previous runs
? Prerequisites validated
? Windows will run on host (no device needed)
?? Building Controls.TestCases.HostApp for Windows...
?? Build command: dotnet build D:\a\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj -f net10.0-windows10.0.19041.0 -c Debug
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics.Win2D -> D:\a\1\s\artifacts\bin\Graphics.Win2D\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Maps -> D:\a\1\s\artifacts\bin\Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Maps.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Xaml -> D:\a\1\s\artifacts\bin\Controls.Xaml\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Xaml.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Foldable -> D:\a\1\s\artifacts\bin\Controls.Foldable\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Foldable.dll
Controls.Maps -> D:\a\1\s\artifacts\bin\Controls.Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Maps.dll
Microsoft.AspNetCore.Components.WebView.Maui -> D:\a\1\s\artifacts\bin\Microsoft.AspNetCore.Components.WebView.Maui\Debug\net10.0-windows10.0.19041.0\Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.TestCases.HostApp -> D:\a\1\s\artifacts\bin\Controls.TestCases.HostApp\Debug\net10.0-windows10.0.19041.0\win-x64\Controls.TestCases.HostApp.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:05:07.42
? Build completed in 314.6582372 seconds
? Windows app ready (runs on host Windows)
?? Determining test project...
? Test project: D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj
?? Running UI tests with filter: Issue34558
?? Executing: dotnet test --filter "Issue34558"
?? Set DEVICE_UDID environment variable: host
?? Set APPIUM_LOG_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\appium.log (screenshots will be saved here)
?? TRX file will be written to: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
?? Actual dotnet test args: D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj --filter Issue34558 --logger trx;LogFileName=Issue34558.trx --logger console;verbosity=normal --results-directory D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults /p:VStestUseMSBuildOutput=false
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
5/24/2026 4:49:56 PM FixtureSetup for Issue34558(Windows)
5/24/2026 4:50:06 PM WebViewLoadsWhenCoexistingWithHybridWebView Start
5/24/2026 4:50:09 PM WebViewLoadsWhenCoexistingWithHybridWebView Stop
Passed WebViewLoadsWhenCoexistingWithHybridWebView [2 s]
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.11] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.32] Discovered: Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 25.5831 Seconds
TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
?? Test output saved to: D:\a\1\s\CustomAgentLogsTmp\UITests\test-output.log
?? Collecting test artifacts (screenshots, page source)...
?? Test artifacts collected: 0 screenshot(s), 0 page source(s) (copied 0 from assembly dir)
?? Capturing device logs...
?? Windows platform - logs captured from test output
?? Windows device log created: D:\a\1\s\CustomAgentLogsTmp\UITests\windows-device.log
═══════════════════════════════════════════════════════
Windows App Logs (Last 100 lines)
═══════════════════════════════════════════════════════
Windows UI Test run at 05/24/2026 16:50:11
?? Full device log: D:\a\1\s\CustomAgentLogsTmp\UITests\windows-device.log
═══════════════════════════════════════════════════════
? All tests passed
╔═══════════════════════════════════════════════════════════╗
║ Test Summary ║
╠═══════════════════════════════════════════════════════════╣
║ Platform: WINDOWS ║
║ Device: host ║
║ Test Filter: Issue34558 ║
║ Result: SUCCESS ? ║
║ Logs: D:\a\1\s\CustomAgentLogsTmp\UITests
╚═══════════════════════════════════════════════════════════╝
`
Failure Analysis
Not failed. The test evidence indicates this approach resolves the exercised Issue34558 scenario. Remaining concern: creating and closing a transient WebView2 just to obtain its implicit environment may add startup overhead and could have lifecycle side effects not covered by the regression test.
try-fix-5
Try-fix 5: Shared WebView2 Environment Provider
Approach
Introduced a shared Windows WebView2 environment provider used by both regular MauiWebView and HybridWebView. Regular WebView now explicitly initializes with the shared default environment before navigation instead of relying on WebView2 implicit initialization. HybridWebView creates a custom environment only for environment-level customizations; when only controller options are customized, it reuses the shared default environment and applies controller options.
This differs from PR #35585 because it fixes the mismatch at both sides rather than only gating HybridWebView. It also avoids the prior candidates' isolated user-data folders and transient WebView2 borrowing.
Diff
diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
index f9cef27e49..33c2742f11 100644
--- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
@@ -307,17 +307,35 @@ namespace Microsoft.Maui.Handlers
var initializingArgs = new WebViewInitializationStartedEventArgs();
VirtualView?.WebViewInitializationStarted(initializingArgs);
- var env = await CoreWebView2Environment.CreateWithOptionsAsync(
- browserExecutableFolder: initializingArgs.BrowserExecutableFolder,
- userDataFolder: initializingArgs.UserDataFolder,
- options: initializingArgs.EnvironmentOptions);
+ var hasCustomEnvironment =
+ initializingArgs.BrowserExecutableFolder != null ||
+ initializingArgs.UserDataFolder != null ||
+ initializingArgs.EnvironmentOptions != null;
- var options = env.CreateCoreWebView2ControllerOptions();
- options.ScriptLocale = initializingArgs.ScriptLocale;
- options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled;
- options.ProfileName = initializingArgs.ProfileName;
+ var hasControllerOptions =
+ !string.IsNullOrEmpty(initializingArgs.ScriptLocale) ||
+ initializingArgs.IsInPrivateModeEnabled ||
+ !string.IsNullOrEmpty(initializingArgs.ProfileName);
- await webView.EnsureCoreWebView2Async(env, options);
+ if (hasCustomEnvironment)
+ {
+ var env = await CoreWebView2Environment.CreateWithOptionsAsync(
+ browserExecutableFolder: initializingArgs.BrowserExecutableFolder,
+ userDataFolder: initializingArgs.UserDataFolder,
+ options: initializingArgs.EnvironmentOptions);
+
+ await webView.EnsureCoreWebView2Async(env, CreateControllerOptions(env, initializingArgs));
+ }
+ else if (hasControllerOptions)
+ {
+ var env = await MauiWebView2Environment.GetDefaultEnvironmentAsync();
+
+ await webView.EnsureCoreWebView2Async(env, CreateControllerOptions(env, initializingArgs));
+ }
+ else
+ {
+ await MauiWebView2Environment.EnsureCoreWebView2Async(webView);
+ }
webView.CoreWebView2.Settings.AreDevToolsEnabled = Handler?.DeveloperTools.Enabled ?? false;
webView.CoreWebView2.Settings.IsWebMessageEnabled = true;
@@ -334,6 +352,16 @@ namespace Microsoft.Maui.Handlers
return true;
}
+ private static CoreWebView2ControllerOptions CreateControllerOptions(CoreWebView2Environment env, WebViewInitializationStartedEventArgs initializingArgs)
+ {
+ var options = env.CreateCoreWebView2ControllerOptions();
+ options.ScriptLocale = initializingArgs.ScriptLocale;
+ options.IsInPrivateModeEnabled = initializingArgs.IsInPrivateModeEnabled;
+ options.ProfileName = initializingArgs.ProfileName;
+
+ return options;
+ }
+
private void OnWebResourceRequested(CoreWebView2 sender, CoreWebView2WebResourceRequestedEventArgs args)
{
Handler?.OnWebResourceRequested(sender, args);
diff --git a/src/Core/src/Platform/Windows/MauiWebView.cs b/src/Core/src/Platform/Windows/MauiWebView.cs
index 0ab25046a5..31be2f8723 100644
--- a/src/Core/src/Platform/Windows/MauiWebView.cs
+++ b/src/Core/src/Platform/Windows/MauiWebView.cs
@@ -1,8 +1,10 @@
-using System;
+using System;
using System.Diagnostics;
using System.Text;
+using System.Threading.Tasks;
using Microsoft.Maui.ApplicationModel;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.Web.WebView2.Core;
using Windows.ApplicationModel;
namespace Microsoft.Maui.Platform
@@ -53,7 +55,7 @@ namespace Microsoft.Maui.Platform
mapBaseDirectory = true;
}
- await EnsureCoreWebView2Async();
+ await MauiWebView2Environment.EnsureCoreWebView2Async(this);
if (mapBaseDirectory)
{
@@ -74,11 +76,11 @@ namespace Microsoft.Maui.Platform
{
Uri uri = new Uri(url ?? string.Empty, UriKind.RelativeOrAbsolute);
+ await MauiWebView2Environment.EnsureCoreWebView2Async(this);
+
if (!uri.IsAbsoluteUri ||
IsUriWithLocalScheme(uri.AbsoluteUri))
{
- await EnsureCoreWebView2Async();
-
CoreWebView2.SetVirtualHostNameToFolderMapping(
LocalHostName,
ApplicationPath,
@@ -156,4 +158,27 @@ namespace Microsoft.Maui.Platform
return $"<script>{BaseInsertionScript.Replace("baseTag", baseTag, StringComparison.Ordinal)}</script>";
}
}
+
+ internal static class MauiWebView2Environment
+ {
+ static readonly object DefaultEnvironmentLock = new();
+ static Task<CoreWebView2Environment>? s_defaultEnvironmentTask;
+
+ public static async Task EnsureCoreWebView2Async(WebView2 webView)
+ {
+ var environment = await GetDefaultEnvironmentAsync();
+ await webView.EnsureCoreWebView2Async(environment);
+ }
+
+ public static Task<CoreWebView2Environment> GetDefaultEnvironmentAsync()
+ {
+ lock (DefaultEnvironmentLock)
+ {
+ return s_defaultEnvironmentTask ??= CoreWebView2Environment.CreateWithOptionsAsync(
+ browserExecutableFolder: null,
+ userDataFolder: null,
+ options: null).AsTask();
+ }
+ }
+ }
}
Test Results
Command: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform windows -TestFilter "Issue34558"
Result: Pass
Key output:
?? Running UI tests with filter: Issue34558
?? Executing: dotnet test --filter "Issue34558"
?? Set DEVICE_UDID environment variable: host
?? Set APPIUM_LOG_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\appium.log (screenshots will be saved here)
?? TRX file will be written to: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
?? Actual dotnet test args: D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj --filter Issue34558 --logger trx;LogFileName=Issue34558.trx --logger console;verbosity=normal --results-directory D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults /p:VStestUseMSBuildOutput=false
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.80-ci+azdo.14182765
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 5/24/2026 5:04:22 PM FixtureSetup for Issue34558(Windows)
>>>>> 5/24/2026 5:04:31 PM WebViewLoadsWhenCoexistingWithHybridWebView Start
>>>>> 5/24/2026 5:04:35 PM WebViewLoadsWhenCoexistingWithHybridWebView Stop
Passed WebViewLoadsWhenCoexistingWithHybridWebView [4 s]
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.12] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.31] Discovered: Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 27.1773 Seconds
>>> TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue34558.trx
?? Test output saved to: D:\a\1\s\CustomAgentLogsTmp\UITests\test-output.log
?? Collecting test artifacts (screenshots, page source)...
?? Test artifacts collected: 0 screenshot(s), 0 page source(s) (copied 0 from assembly dir)
?? Capturing device logs...
?? Windows platform - logs captured from test output
?? Windows device log created: D:\a\1\s\CustomAgentLogsTmp\UITests\windows-device.log
═══════════════════════════════════════════════════════
Windows App Logs (Last 100 lines)
═══════════════════════════════════════════════════════
Windows UI Test run at 05/24/2026 17:04:38
?? Full device log: D:\a\1\s\CustomAgentLogsTmp\UITests\windows-device.log
═══════════════════════════════════════════════════════
? All tests passed
╔═══════════════════════════════════════════════════════════╗
║ Test Summary ║
╠═══════════════════════════════════════════════════════════╣
║ Platform: WINDOWS ║
║ Device: host ║
║ Test Filter: Issue34558 ║
║ Result: SUCCESS ? ║
║ Logs: D:\a\1\s\CustomAgentLogsTmp\UITests
╚═══════════════════════════════════════════════════════════╝
Self-review
Expert self-review findings: 0 (
eviewer-findings.json contains []).
Failure Analysis
Not failed. Iteration 1 exposed a compile issue (IAsyncOperation could not be assigned to Task); converting the WinRT operation with .AsTask() fixed the compile error and the validation test passed.
📋 Report — Final Recommendation
Comparative Report - PR #35585
Candidates compared
All final candidates from STEP 6a were considered. None of the final candidates failed the Issue34558 regression test; the only recorded failure was an internal first iteration of try-fix-1, which was replaced before the final candidate result.
| Rank | Candidate | Regression result | Assessment |
|---|---|---|---|
| 1 | pr-plus-reviewer |
PASS by shared-provider validation equivalence | Best overall. Applies the expert review feedback by separating environment-level settings from controller-only settings and using a shared WebView2 default environment, preserving controller options while avoiding the explicit-default-vs-implicit-default conflict. |
| 2 | try-fix-5 |
PASS | Same strongest technical direction as pr-plus-reviewer: shared explicit WebView2 environment provider used by both regular MauiWebView and HybridWebView. Ranked just below because pr-plus-reviewer is the PR-context candidate with the expert feedback applied. |
| 3 | pr |
PASS | Minimal servicing fix and validated for the reported default scenario. Ranked below the reviewer-applied candidate because the expert reviewer found that controller-only customizations still take the conflicting explicit default environment path. |
| 4 | try-fix-4 |
PASS | Borrows the implicit default environment via a transient WebView2, preserving controller options without changing storage location. It adds startup/lifecycle overhead and a temporary control solely to obtain the environment, making it riskier than the shared-provider approach. |
| 5 | try-fix-3 |
PASS | Uses a cached explicit default environment for controller-only HybridWebView settings. It preserves controller options, but the regression test does not exercise that path and regular WebView still uses implicit initialization, so the implicit-vs-explicit mismatch may remain. |
| 6 | try-fix-2 |
PASS, partial artifact | Avoids conflict by isolating HybridWebView into a different default user-data folder. This changes existing storage/cache/cookie behavior and the full diff artifact was not persisted, so it is less suitable. |
| 7 | try-fix-1 |
PASS | Avoids the controller-only conflict by not applying controller-only options unless environment-level settings are supplied. This risks regressing existing supported customization scenarios such as ProfileName, so it ranks lowest among passing candidates. |
Winner
pr-plus-reviewer wins.
The raw PR is the smallest backport and fixes the tested default scenario, but the expert reviewer identified a real remaining edge case: controller-only options still create a separate default-folder environment. The reviewer-applied candidate addresses that gap while preserving controller options, and it matches the strongest passing try-fix design without adopting the storage behavior change from try-fix-2 or the option-dropping behavior from try-fix-1.
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines successfully started running 2 pipeline(s). |
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!
Backport of #35092 to
release/10.0.1xx-sr7./cc @PureWeen