Repository navigation
fix(winappsdk): Keep NuGet's Windows assets so trimming links them - #25860
Merged
ramezgerges merged 1 commit intoNov 2, 2026
Merged
ramezgerges merged 1 commit into
ramezgerges merged 1 commit into
Conversation
_UnoRemoveReferences replaced the Uno.WinUI references NuGet resolved with lib/net10.0-windows10.0.19041.0, whatever the app's TFM. In a net11 app the published Uno.UI.Extras.dll no longer matched the item the linker works from, so it shipped untrimmed while the linker removed the facades it references, and the app crashed at startup (fixes unoplatform#24577). The Windows assets NuGet resolved are now kept. The swap only runs when NuGet picked the cross-platform assets, from the folder matching the app's .NET version, which the Extras .pri and assets use too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
MartinZikmund
approved these changes
Nov 2, 2026
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
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 #24577
PR Type:
🐞 Bugfix
What changed? 🚀
A trimmed WinAppSDK app can crash at startup (
0xC000027BinMicrosoft.UI.Xaml.dll,FileNotFoundException: System.Runtime) becauseUno.UI.Extras.dllskips the linker.Cause.
_UnoRemoveReferences(uno.winui.winappsdk.targets) removed theUno.WinUIreferences NuGet resolved and re-added$(PkgUno_WinUI)/lib/net10.0-windows10.0.19041.0/*.dll, whatever the app's TFM. The package shipslib/net10.0-windows…andlib/net11.0-windows…, so for a net11 app:Uno.UI.Extras.dll, and the runtime/linker items keep that path;System.Runtime,System.Threading), and the XAML type info fails to loadUno.UI.Extrastypes at startup.The issue reports the same on 6.x, where the hardcoded folder is
net9and every .NET 10 app is affected; on master it's .NET 11 apps.Fix.
Uno.WinUI's Windows assets for the app's TFM, they're kept as they are, so they go through trimming and ReadyToRun like any package assembly.lib/net1x.0(a TFM below the package's Windows SDK version), from the folder matching the app's .NET version (GetTargetFrameworkVersion) instead of a hardcoded one._UnoIncludeUIExtrastakes the.priandUno.UI.Extras/**assets from that same folder.Validation (runtime): a minimal
net11.0-windows10.0.26100.0WinAppSDK app onUno.WinUI 7.0.0-dev.2509usingex:CommandBarExtensions.Subtitle(Uno.UI.Extras) in XAML, self-contained unpackaged publish (withEnableMsixTooling), with these targets applied by overriding the two package targets:Uno.UI.Extras.dllTrimMode=full, current targetsSystem.Runtime.dll/System.Threading.dlltrimmed0xC000027B,FileNotFoundException: System.Runtime, Version=10.0.0.0TrimMode=full, this PRNot covered: the fallback branch end to end. With a
net11.0-windows10.0.17763.0TFM NuGet does resolvelib/net11.0, but the app fails to compile with CS0433 (DispatcherQueuedefined in two assemblies) both with and without this change, so that branch's behavior is unchanged but not exercised. Validated unpackaged, not as MSIX (same linker inputs).6.x (
servicing/6.8,release/stable/6.7) hardcodenet9and would need a backport.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code