Repository navigation
fix(sdk): Hide unused WebView2Aot references from ILLink - #26696
Open
ramezgerges wants to merge 1 commit into
Open
ramezgerges wants to merge 1 commit into
ramezgerges wants to merge 1 commit into
Conversation
Leaving the WebView2Aot/DirectN assets out of the app did not stop a trimmed publish from hanging: their compile assets stay in ReferencePath, so ILLink still loads them and walks the WebView2 interface chains for the types the Win32 host touches. They are now removed from ReferencePath for the ILLink step only, and put back afterwards. Fixes unoplatform#24618 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
1 of 2 tasks
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
ajpinedam
approved these changes
Nov 24, 2026
Xiaoy312
approved these changes
Nov 24, 2026
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.
GitHub Issue: closes #24618
PR Type:
🐞 Bugfix
What changed? 🚀
A trimmed desktop publish still hangs at "Optimizing assemblies for size" on Uno.Sdk 7.0.22, which includes #25862, for an app that never uses a WebView (report).
Why #25862 wasn't enough. It leaves the WebView2Aot/DirectNAot runtime assets out of the app. Their compile assets stay in
ReferencePath, becauseUno.UI.Runtime.Win32compiles against them, and_RunILLinkpasses everyReferencePathitem to ILLink as-reference … --action skip. ILLink still loads them and walks the 29-deepICoreWebView2_*chain for the WebView2 types the host touches, which is the walk from dotnet/runtime#136766.The 18 s result in #25862 came from its first revision, which also removed the compile assets. A later revision kept them, so a head that uses DirectN itself still compiles, and the trimmed publish wasn't timed again. On the same machine today, the first revision publishes the original repro in 16 s and the merged one is still in ILLink after 10 minutes.
Fix. Two targets next to
_UnoRemoveUnusedWebView2Aot:_UnoHideUnusedWebView2AotFromILLinkruns afterPrepareForILLinkand removes fromReferencePaththe packages fix(sdk): Leave out WebView2Aot assets when WebView is unused #25862 already marked unused (_UnoUnusedWebView2Packages, matched onNuGetPackageId)._UnoRestoreUnusedWebView2AotReferencesputs them back afterILLink.Compile references are untouched. Nothing changes when the app uses a WebView, when DirectN has another owner (only WebView2Aot is hidden then), or with
UnoIncludeWebView2Aot=true.Validation. Uno.Sdk 7.0.22 repacked as
7.0.22-local.1with only this change applied to itsUno.SingleProject.Desktop.targets, on a freshunoappdesktop head (UnoFeatures=Skia),dotnet publish -f net10.0-desktop -r win-x64 --self-contained -p:PublishTrimmed=true:WebView2/DirectNshipped; app starts and rendersWebView2hidden;DirectN.dllshipped; the head's DirectN code runs in the trimmed appPublishAot=true)With
TrimmerSingleWarn=false, the trimmed publishes report 26 IL2050 (Win32 UI Automation P/Invokes) and 2 IL2026 (macOS WebView JSON), the same ones #25862 recorded. None mention WebView2, DirectN or an unresolved assembly.Apps that use a WebView still need the ILLink fix (dotnet/runtime#136766) for a trimmed publish.
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code