Allow Opt-out of using the WebView2CompositionControl for WPF BlazorWebView#34764
Open
mobiletonster wants to merge 195 commits intodotnet:mainfrom
Open
Allow Opt-out of using the WebView2CompositionControl for WPF BlazorWebView#34764mobiletonster wants to merge 195 commits intodotnet:mainfrom
mobiletonster wants to merge 195 commits intodotnet:mainfrom
Conversation
* Try fix building with iOS net11 * More net11 changes * Update iOS versions * Update net9 version * Fix version global IOS * Update version * Update XCode * Disable DotNetPrevious tests * Needs to be net10 * Ignore Windows tests * Run net10 targetframework
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
## Description This PR enables CoreCLR iOS and MacCatalyst device tests, mirroring the existing Android CoreCLR device tests implementation. ## Changes: - Added useCoreClr and /p:UseMonoRuntime=false when building with CoreCLR - Enabled device tests
## Description This PR fixes CoreCLR build.
# Conflicts: # eng/Versions.props # eng/common/core-templates/job/publish-build-assets.yml # eng/common/core-templates/post-build/post-build.yml # eng/common/core-templates/steps/install-microbuild.yml # eng/pipelines/ci-device-tests.yml # eng/pipelines/ci-official.yml # eng/pipelines/ci-uitests.yml # eng/pipelines/ci.yml # eng/pipelines/device-tests.yml # eng/pipelines/handlers.yml # eng/pipelines/ui-tests.yml
### Description of Change Bring latest from main to net11
### Description of Change This pull request expands the device test pipeline to add support for running CoreCLR Helix tests on iOS and MacCatalyst, in addition to Android. The changes update the build and test stages to include these new platforms and adjust build parameters accordingly. **Pipeline expansion for CoreCLR device tests:** * Updated the `devicetests_build_coreclr` stage to reflect that it now builds for iOS and MacCatalyst in addition to Android, as shown in its `displayName`. * Modified the build script invocation to always include iOS and MacCatalyst target frameworks for device tests, removing `/p:IncludeIosTargetFrameworks=false` and `/p:IncludeMacCatalystTargetFrameworks=false` so these platforms are now built. **New test stages for additional platforms:** * Added a new `devicetests_ios_coreclr` stage to run CoreCLR Helix device tests on iOS, including downloading build artifacts and sending tests to Helix with appropriate parameters. * Added a new `devicetests_catalyst_coreclr` stage to run CoreCLR Helix device tests on MacCatalyst, with similar steps as the iOS stage. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
### Description of Change Update sdk and workloads on net11
This pull request updates the following dependencies [marker]: <> (Begin:1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) ## From https://github.com/dotnet/macios - **Subscription**: [1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce](https://maestro.dot.net/subscriptions?search=1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) - **Build**: [20260109.1](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13067712) ([296608](https://maestro.dot.net/channel/8298/github:dotnet:macios/build/296608)) - **Date Produced**: January 9, 2026 2:38:42 PM UTC - **Commit**: [fbf9398e3af05523a8956bdc95b77a9e282953ea](dotnet/macios@fbf9398) - **Branch**: [net11.0](https://github.com/dotnet/macios/tree/net11.0) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [26.2.11231-ci.net11-0 to 26.2.11232-ci.net11-0][1] - Microsoft.iOS.Sdk.net11.0_26.2 - Microsoft.MacCatalyst.Sdk.net11.0_26.2 - Microsoft.macOS.Sdk.net11.0_26.2 - Microsoft.tvOS.Sdk.net11.0_26.2 [1]: dotnet/macios@aced0a1...fbf9398 [DependencyUpdate]: <> (End) [marker]: <> (End:1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
# Conflicts: # eng/helix_xharness.proj
This pull request updates the following dependencies [marker]: <> (Begin:9a046932-c60c-436e-8fc7-8ea2f5902cb4) ## From https://github.com/dotnet/android - **Subscription**: [9a046932-c60c-436e-8fc7-8ea2f5902cb4](https://maestro.dot.net/subscriptions?search=9a046932-c60c-436e-8fc7-8ea2f5902cb4) - **Build**: [11.0.0-c1.net11.26058.1+azdo.13060433](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13060433) ([296455](https://maestro.dot.net/channel/8298/github:dotnet:android/build/296455)) - **Date Produced**: January 8, 2026 7:05:28 PM UTC - **Commit**: [1878a87228622c90a16787016fcb2e01b8bc052b](dotnet/android@1878a87) - **Branch**: [main](https://github.com/dotnet/android/tree/main) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [36.1.99-ci.main.77 to 36.1.99-ci.main.83][1] - Microsoft.Android.Sdk.Windows [1]: dotnet/android@9297282...1878a87 [DependencyUpdate]: <> (End) [marker]: <> (End:9a046932-c60c-436e-8fc7-8ea2f5902cb4) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
This pull request updates the following dependencies [marker]: <> (Begin:9a046932-c60c-436e-8fc7-8ea2f5902cb4) ## From https://github.com/dotnet/android - **Subscription**: [9a046932-c60c-436e-8fc7-8ea2f5902cb4](https://maestro.dot.net/subscriptions?search=9a046932-c60c-436e-8fc7-8ea2f5902cb4) - **Build**: [11.0.0-c1.net11.26062.1+azdo.13082281](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13082281) ([296966](https://maestro.dot.net/channel/8298/github:dotnet:android/build/296966)) - **Date Produced**: January 12, 2026 11:52:56 PM UTC - **Commit**: [51a138deee3f08083a571f803d72dcb8bdb45f70](dotnet/android@51a138d) - **Branch**: [main](https://github.com/dotnet/android/tree/main) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [36.1.99-ci.main.83 to 36.1.99-ci.main.88][2] - Microsoft.Android.Sdk.Windows [2]: dotnet/android@1878a87...51a138d [DependencyUpdate]: <> (End) [marker]: <> (End:9a046932-c60c-436e-8fc7-8ea2f5902cb4) --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Integration tests require ios-simulator-64_18.5 but Xcode 26.2 only includes iOS 26.2 by default. This adds a step to download the iOS 18.5 simulator runtime after the default simulator installation.
This pull request updates the following dependencies [marker]: <> (Begin:1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) ## From https://github.com/dotnet/macios - **Subscription**: [1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce](https://maestro.dot.net/subscriptions?search=1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) - **Build**: [20260113.1](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13087503) ([297127](https://maestro.dot.net/channel/8298/github:dotnet:macios/build/297127)) - **Date Produced**: January 13, 2026 5:18:33 PM UTC - **Commit**: [13be6a67ad7fb5968639d67a357bd04f892ed381](dotnet/macios@13be6a6) - **Branch**: [net11.0](https://github.com/dotnet/macios/tree/net11.0) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [26.2.11232-ci.net11-0 to 26.2.11233-ci.net11-0][1] - Microsoft.iOS.Sdk.net11.0_26.2 - Microsoft.MacCatalyst.Sdk.net11.0_26.2 - Microsoft.macOS.Sdk.net11.0_26.2 - Microsoft.tvOS.Sdk.net11.0_26.2 [1]: dotnet/macios@fbf9398...13be6a6 [DependencyUpdate]: <> (End) [marker]: <> (End:1ae85174-dfc1-4a00-b3c3-5a31c41fb9ce) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
This pull request updates the following dependencies [marker]: <> (Begin:9a046932-c60c-436e-8fc7-8ea2f5902cb4) ## From https://github.com/dotnet/android - **Subscription**: [9a046932-c60c-436e-8fc7-8ea2f5902cb4](https://maestro.dot.net/subscriptions?search=9a046932-c60c-436e-8fc7-8ea2f5902cb4) - **Build**: [11.0.0-c1.net11.26063.1+azdo.13087794](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13087794) ([297134](https://maestro.dot.net/channel/8298/github:dotnet:android/build/297134)) - **Date Produced**: January 13, 2026 5:43:47 PM UTC - **Commit**: [16bb23264f2e802dfdc85e5b4bd2f275115d99fe](dotnet/android@16bb232) - **Branch**: [main](https://github.com/dotnet/android/tree/main) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [36.1.99-ci.main.88 to 36.1.99-ci.main.89][1] - Microsoft.Android.Sdk.Windows [1]: dotnet/android@51a138d...16bb232 [DependencyUpdate]: <> (End) [marker]: <> (End:9a046932-c60c-436e-8fc7-8ea2f5902cb4) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
- Update Android APK path from net11.0-android to net10.0-android in helix_xharness.proj - Remove quotes from HelixProjectArguments for iOS and MacCatalyst CoreCLR scenarios to fix MSBuild argument parsing
…device tests (dotnet#33474) - Add universal binary search logic in devices-shared.cake for iOS/macCatalyst - Add ARM64 agent demands for MAUI pool in ci-device-tests.yml and ci-uitests.yml - Update RuntimeIdentifiers to use CI/TF_BUILD environment variable checks
…template updates (dotnet#34945) Fixes dotnet#34788 Aligns the MAUI Blazor Hybrid templates with recent non-Identity changes to the ASP.NET Core Blazor Web App template. ## Changes ### 1. Remove inline JS event handler from `NavMenu` Replace inline `onclick` handler with a collocated `NavMenu.razor.js` ES6 module in both `maui-blazor` and `maui-blazor-solution` templates. ### 2. Fix `RequestId` flashing on Error page using `PersistentState` Add `[PersistentState]` attribute to `RequestId` property in `Error.razor` and use null-coalescing assignment (`??=`) to prevent value flashing during interactive transition. ### 3. Use `BasePath` component instead of `<base href>` Replace static `<base href="/" />` with `<BasePath />` component in the solution web template's `App.razor`. ### 4. Add Docker support flag Add `"supportsDocker": true` to `ide.host.json` to enable the 'Add Docker Support' option in Visual Studio for the solution template. See: dotnet#34788 (comment) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- 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! Fixes dotnet#34867 ## Summary Prevent NativeAOT/full-trim analysis from surfacing `HybridWebViewHandler` warnings when `HybridWebView` is feature-switched off. ## Root cause `HybridWebView` was already being disabled for `PublishAot=true` / `TrimMode=full` via `MauiHybridWebViewSupported=false`. The warning still leaked because the default controls handler registration path directly referenced `HybridWebViewHandler`, which carries `RequiresDynamicCode` / `RequiresUnreferencedCode` annotations. ## What changed - keep the existing `RuntimeFeature.IsHybridWebViewSupported` gate - move the `HybridWebView` registration into a guarded local helper - attach the AOT/trimming annotations to that guarded path instead of the default registration flow ## Why this approach This fixes the actual reachability/analysis shape instead of suppressing the warning or expanding the expected-warning baseline. ## Validation - `dotnet build src/Controls/src/Core/Controls.Core.csproj -f net11.0` - local NativeAOT integration flow no longer emitted the previous unexpected `HybridWebViewHandler` warning; remaining local failures were unrelated environment/feed restore issues --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Summary Fix nullable dereference warnings (CS8602) in `ToolbarBadgePage.cs` that break Samples integration tests on both Windows and macOS. ## Root Cause PR dotnet#34669 ("Add BadgeText, BadgeColor, and BadgeTextColor support to ToolbarItem") introduced `ToolbarBadgePage.cs` where `_statusLabel` is initialized on line 68 but captured in lambda closures on lines 33, 46, and 60 — before the assignment. The compiler cannot prove non-null at the capture points, emitting CS8602 on all 3 lines across all TFMs. ## Fix Move `_statusLabel` initialization before the lambda closures that reference it. No behavioral change — the label object is the same, just created earlier in the constructor. ## Validation - `dotnet build Maui.Controls.Sample.csproj -f net11.0 -p:TreatWarningsAsErrors=true` — 0 warnings, 0 errors --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t#34991) ## Problem PR dotnet#34669 (ToolbarItem Badge Support) added Issue8305_Toolbar.cs with `[Issue(IssueTracker.Github, 8305, ...)]`, but Issue8305.cs (Shell Badge, from PR dotnet#34659) already uses issue number 8305. Both generated the same `DisplayName = "G8305"`, causing `VerifyNoDuplicates()` in `TestCases.cs` to throw `NotSupportedException` at app startup, crashing the **entire HostApp** and failing **ALL** Windows UI tests (not just toolbar tests). This crash has been present since build [1371858](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1371858) (PR dotnet#34669 merge). The follow-up PR dotnet#34963 fixed nullable warnings but did not address this crash. ## Root Cause `TestCases.cs:VerifyNoDuplicates()` (line 161-175) uses a HashSet to check for duplicate `DisplayName` values. When two `[Issue]` attributes share the same tracker and number with default `issueTestNumber=0`, they produce identical display names, triggering the crash. ## Fix 1. **Add `issueTestNumber: 1`** to `Issue8305_Toolbar`'s `[Issue]` attribute, producing unique `DisplayName = "G8305 (1)"` instead of duplicate `"G8305"` 2. **Replace non-existent icon images** (`envelope.png`, `bell.png`, `cart.png`) with images that exist in HostApp resources (`bank.png`, `calculator.png`, `shopping_cart.png`) ## Verification - Both `Controls.TestCases.HostApp` (Windows TFM) and `Controls.TestCases.Shared.Tests` build successfully - The `issueTestNumber` pattern is well-established (used by Issue11769, Issue13126_2, Issue1583_1, Issue28986_Border, and others) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tnet#34978) ## Problem All 17 macOS CI jobs on `net11.0` are failing after the SDK bump in dotnet#34852. The provisioning script runs `xcodebuild -downloadPlatform iOS` **without pinning a version**, which downloads the **latest available** simulator runtime (iOS 26.3.1) instead of the one matching the selected Xcode 26.2. The macios SDK `26.2.11588-net11-p3` expects iphonesimulator SDK `23C53` (iOS 26.2), but the installed simulator is iOS 26.3.1 (`23D8133`). This causes: ``` actool: No simulator runtime version from ["22F77"] available to use with iphonesimulator SDK version 23C53 ibtool: iOS 26.2 Platform Not Installed ``` ## Evidence From build [1379721](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1379721) (`Install Simulator Runtimes` log): 1. First attempt: `Unable to connect to simulator` (exit code 70) 2. Script deletes all runtimes, retries 3. Retry installs **iOS 26.3.1** (not iOS 26.2) 4. Every macOS build/test job fails downstream The Xcode 26.0 case already had this fix — it explicitly pins `-buildVersion 26.0`. The bug was only in the `else` branch for Xcode 26.1+. ## Fix Pin `-buildVersion ${MAJOR}.${MINOR}` for all Xcode 26.x versions (where iOS version matches Xcode version). Include `-architectureVariant universal` for x64 simulator support on Apple Silicon agents. Keep unpinned download for pre-26 Xcode where the version mapping differs (Xcode 16.x → iOS 18.x). ## Reviewed by Approach validated by 3 independent AI models (Sonnet 4.6, Opus 4.6, Codex 5.3) — all agreed on the fix and flagged the two concerns addressed in the final version: 1. ✅ Include `-architectureVariant universal` for all 26.x (not just 26.0) 2. ✅ Guard with `MAJOR == 26` to avoid breaking pre-26 Xcode branches --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…otnet#34969) <!-- 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! ## Description Fixes dotnet#34910 `MKMapView.Overlays` returns `null` (not an empty array) when no overlays have been added to the map. The `OnMapClicked` handler in `MauiMKMapView.cs` iterated `.Overlays` without a null check, causing a `NullReferenceException` when tapping the map. This was introduced by the "Add Circle, Polygon, and Polyline click events" feature (dotnet#29101) on the net11.0 branch. ## Changes **Fix** (`MauiMKMapView.cs`): - Added null check for `mauiMkMapView.Overlays` before iterating, following the existing null guard pattern from `ClearMapElements()` at line 322. **Tests** (`MapTests.cs`): - ` Verifies `IMap.Clicked` does not throw when the map has no elementsClickedDoesNotThrowWithNoElements` - ` Verifies the `MapClicked` event fires correctly with proper location data when no map elements existClickedFiresEventWithNoElements` ## Root Cause The `OnMapClicked` static method (line 568) did: ```csharp foreach (var overlay in mauiMkMapView.Overlays) // NullRef when Overlays is null ``` `MKMapView.Overlays` is a native iOS property that returns `null` when no overlays exist (unlike .NET collections which typically return empty). The fix stores the value first and returns early if null: ```csharp var overlays = mauiMkMapView.Overlays; if (overlays is null) return; foreach (var overlay in overlays) ``` This matches the existing pattern in `ClearMapElements()`: ```csharp var elements = Overlays; if (elements == null) return; ``` Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 20, 2026
…ethod (dotnet#34986) ## Problem PR dotnet#34958's fix for the HybridWebView IL3050 warning used a **local function** inside `AddControlsHandlers`. This worked with SDK `26166.111` but **fails with the newer SDK** `26203.107` (from dotnet#34852): ``` Unexpected warning: AppHostBuilderExtensions.<AddControlsHandlers>g__AddHybridWebViewHandler|2_0 has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. ``` The C# compiler emits local functions as `<EnclosingMethod>g__Name|N_M` — a compiler-generated method that newer ILC versions trace back to the caller, defeating the `[FeatureGuard]` suppression on `RuntimeFeature.IsHybridWebViewSupported`. ## Fix Move the local function to a **private static method** on the class. This creates a real method boundary in IL metadata that the `[FeatureGuard]` can properly suppress — the standard pattern documented in our [trim/AOT review rules](https://github.com/dotnet/maui/blob/main/.github/skills/code-review/references/review-rules.md#23-trim--nativeaot-safety). cc @simonrozsival — this builds on your dotnet#34958 fix, just moving from local function to class method for the newer ILC. ## Validation `dotnet build Controls.Core.csproj -f net11.0 -p:TreatWarningsAsErrors=true` — 0 errors --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reset patterns: - global.json - NuGet.config - eng/Version.Details.xml - eng/Versions.props - eng/common/*
# Conflicts: # src/Controls/samples/Controls.Sample/Pages/PlatformSpecifics/iOS/iOSLargeTitlePage.xaml.cs # src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs # src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt # src/Controls/src/SourceGen/AnalyzerReleases.Unshipped.md # src/Controls/src/Xaml/XmlName.cs # src/Controls/tests/ManualTests/Controls.ManualTests.csproj # src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicTabSectionVisibility.png # src/Core/maps/src/Handlers/Map/MapHandler.Android.cs # src/Core/maps/src/Platform/iOS/MauiMKMapView.cs # src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt
Port MapElementId tracking from main (PR dotnet#30116) into net11.0's iOS MauiMKMapView. Tracks added map elements in _trackedMapElements so ClearMapElements can reset MapElementId even after the ObservableCollection is already empty. Also removes duplicate non-nullable PublicAPI entries for ShowInfoWindow and HideInfoWindow (keeping the nullable-annotated versions). Fixes failing ClearMapElementsResetsMapElementId and ClearResetsMapElementIdForAllElementTypes device tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
I detected changes in the main branch which have not been merged yet to net11.0. I'm a robot and am configured to help you automatically keep net11.0 up to date, so I've opened this PR. This PR merges commits made on main by the following committers: * TamilarasanSF4853 * PureWeen * JanKrivanek * kubaflo * mattleibow * Copilot * CathyZhu0110 * Vignesh-SF3580 * StephaneDelcroix * Oxymoron290 * mmitche * akoeplinger * sheiksyedm ## Instructions for merging from UI This PR will not be auto-merged. When pull request checks pass, complete this PR by creating a merge commit, *not* a squash or rebase commit. <img alt="merge button instructions" src="https://i.imgur.com/GepcNJV.png" width="300" /> If this repo does not allow creating merge commits from the GitHub UI, use command line instructions. ## Instructions for merging via command line Run these commands to merge this pull request from the command line. ``` sh git fetch git checkout main git pull --ff-only git checkout net11.0 git pull --ff-only git merge --no-ff main # If there are merge conflicts, resolve them and then run git merge --continue to complete the merge # Pushing the changes to the PR branch will re-trigger PR validation. git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0 ``` <details> <summary>or if you are using SSH</summary> ``` git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0 ``` </details> After PR checks are complete push the branch ``` git push ``` ## Instructions for resolving conflicts :warning: If there are merge conflicts, you will need to resolve them manually before merging. You can do this [using GitHub][resolve-github] or using the [command line][resolve-cli]. [resolve-github]: https://help.github.com/articles/resolving-a-merge-conflict-on-github/ [resolve-cli]: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ ## Instructions for updating this pull request Contributors to this repo have permission update this pull request by pushing to the branch 'merge/main-to-net11.0'. This can be done to resolve conflicts or make other changes to this pull request before it is merged. The provided examples assume that the remote is named 'origin'. If you have a different remote name, please replace 'origin' with the name of your remote. ``` git fetch git checkout -b merge/main-to-net11.0 origin/net11.0 git pull https://github.com/dotnet/maui merge/main-to-net11.0 (make changes) git commit -m "Updated PR with my changes" git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0 ``` <details> <summary>or if you are using SSH</summary> ``` git fetch git checkout -b merge/main-to-net11.0 origin/net11.0 git pull git@github.com:dotnet/maui merge/main-to-net11.0 (make changes) git commit -m "Updated PR with my changes" git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0 ``` </details> Contact .NET Core Engineering (dotnet/dnceng) if you have questions or issues. Also, if this PR was generated incorrectly, help us fix it. See https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
…Android (dotnet#35094) > [!NOTE] > This PR was created with assistance from AI. Port of dotnet#35071 to the `net11.0` branch. ## Summary Add `_PrepareTrimConfiguration` to `_MauiPrepareForILLink`'s `BeforeTargets` so that `RuntimeHostConfigurationOption` items (like `IsHybridWebViewSupported`) are added before the runtime's internal target snapshots them into `_TrimmerFeatureSettings`. ## Problem dotnet/runtime PR #124801 moved the `RuntimeHostConfigurationOption` → `_TrimmerFeatureSettings` conversion from `PrepareForILLink` into an earlier internal target (`_PrepareTrimConfiguration`). MAUI's `_MauiPrepareForILLink` hooks `BeforeTargets="PrepareForILLink"`, which now fires *after* the snapshot. As a result, ILC never receives `--feature` flags for MAUI's feature switches on Android NativeAOT, causing spurious IL3050 warnings for `HybridWebViewHandler`. This is the branch (`net11.0`, SDK `11.0.100-preview.3.26203.107`) where the bug manifests — the .NET 11 SDK has `_PrepareTrimConfiguration`. ## Fix Remove `PrepareForILLink` from `BeforeTargets` (redundant — it's a transitive dependent of `_PrepareTrimConfiguration`) and add `_PrepareTrimConfiguration` instead. This ensures MAUI's `RuntimeHostConfigurationOption` items are present when the snapshot runs. **Temporary workaround** using the internal target name. The runtime fix (dotnet/runtime#127253) renames this to the public `PrepareTrimConfiguration`. Once that flows, update to `BeforeTargets="PrepareTrimConfiguration"`. Workaround for dotnet/runtime#127017 cc @sbomer @simonrozsival Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allows opting out of the WebView2CompositionControl (introduced in net10.0 to fix WPF airspace issues) in favor of the standard WebView2 control when airspace layering is not required and lower rendering overhead is preferred. - Add UseCompositionControl dependency property (default: true) to BlazorWebView, preserving existing behavior by default - Type _webview and the WebView property as IWebView2, the interface implemented by both WebView2 and WebView2CompositionControl - CreateWebViewTemplate() selects the correct control type at init time; the property-changed callback swaps the template if set before the control is added to the visual tree - Throw InvalidOperationException if UseCompositionControl is changed after the underlying WebView2 has already been created - Update WebView2WebViewManager and BlazorWebViewInitializedEventArgs shared source to use IWebView2 for the WPF type alias - Update PublicAPI.Shipped.txt to reflect the IWebView2 return types and new UseCompositionControl public API
…Unshipped.txt I misunderstood how this was used. This should correct it.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Enhanced error reporting when WebView2 template child is missing or of the wrong type. Updated public API to return IWebView2 instead of WebView2CompositionControl for greater abstraction.
c612109 to
543def2
Compare
Collaborator
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This change introduces an opt‑out mechanism for using
WebView2CompositionControlin WPF BlazorWebView scenarios. WhileWebView2CompositionControlresolves the WPF airspace issue, it introduces measurable rendering overhead that negatively impacts Razor component performance.For apps that do not require XAML‑over‑WebView layering, developers can now disable the composition control and fall back to the standard
WebView2, resulting in significantly improved performance on WPF.This feature also addresses feedback from the original
WebView2CompositionControlintroduction(PR #31777: #31777)
and community requests asking for an opt‑in/opt‑out toggle
(Issue #28063: #28063).
Issues Fixed / Related
WebView2CompositionControlrequest and discussion:Allow use of new WebView2CompositionControl for WPF BlazorWebView #28063
Use the WebView2CompositionControl in Blazor WPF #31777
This PR enables opting out of
WebView2CompositionControl(added in .NET 10.0 to address WPF airspace issues) in favor of the standardWebView2when airspace layering is unnecessary and lower rendering overhead is preferred.Summary of Changes
UseCompositionControldependency property (default:true) onBlazorWebView, preserving existing behavior._webviewand theWebViewproperty to useIWebView2, implemented by bothWebView2andWebView2CompositionControl.CreateWebViewTemplate()now selects the correct control type at initialization; the property‑changed callback updates the template if changed before the control is added to the visual tree.InvalidOperationExceptionifUseCompositionControlis modified after the underlying WebView has been created.WebView2WebViewManagerandBlazorWebViewInitializedEventArgsshared source to use the WPFIWebView2alias.IWebView2return types and theUseCompositionControlpublic API surface.Notes
This is not a bug fix; it is a feature/performance enhancement.