Repository navigation
refactor: Strip dead native #if blocks from Uno.UI sources - #23973
Conversation
The directives were removed by #23671 and re-introduced by master-sync merge 0edfe5f. Only Uno.UI.Skia.csproj and Uno.UI.Reference.csproj compile this file and neither defines __WASM__, so the arms were dead: the IsOwnedByTextBlock one referenced _collection.Owner, a member DependencyObjectCollection does not have. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01D5wk47a5fYoVKWwn9xbexY
XAMARIN is only defined for the native Apple and Android targets, which Uno.UI no longer builds. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01D5wk47a5fYoVKWwn9xbexY
|
Claude finished @MartinZikmund's task in 2m 28s —— View job PR Review
SummaryVerdict: ✅ LGTM — no blocking issues found.
Repo-wide sweep confirmed: only two files in Non-blocking suggestion (out of scope for this PR): |
There was a problem hiding this comment.
Pull request overview
This PR removes dead preprocessor branches from shared src/Uno.UI sources that no longer compile under any active Uno.UI head (Skia + Reference), reducing maintenance overhead and eliminating unreachable code paths.
Changes:
InlineCollection.cs: removes__WASM__-guarded branches and makes the non-WASM implementation unconditional (including focus-clearing paths and parent-walk logic).DoubleExtensions.cs: removesXAMARIN-guarded branches and keeps the non-XamarinIsFiniteimplementations.
Cross-cutting note (process):
- The PR description references private issues (
unoplatform/uno-private#...) and uses short-form “Closes …”. Repo contribution rules require a fully qualified public GitHub issue link (or the explicit “Note: No related issue … Approved by …” exception). This should be updated before merge.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Documents/InlineCollection.cs | Collapses dead __WASM__ branches and keeps the live Skia/Reference implementation unconditional. |
| src/Uno.UI/Extensions/DoubleExtensions.cs | Collapses dead XAMARIN branches, leaving consistent finite checks across active heads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23973/wasm-skia-net9/index.html |
|
The build 225899 found UI Test snapshots differences: Details
|
GitHub Issue: Part of epic unoplatform/uno-private#2049 — 🦋 Drop native targets. Closes unoplatform/uno-private#2096.
PR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
Strips the dead native
#ifbranches left in sharedsrc/Uno.UIsources after the native drop.InlineCollection.cs— a sync regressionSix
__WASM__directives. #23671 removed them; master-sync merge0edfe5fa75(2026-07-29) put them back, because master had edited the file while this branch had rewritten it.They are provably dead:
src/Uno.UIhas exactly two heads —Uno.UI.Skia.csproj(UnoRuntimeIdentifier=Skia) andUno.UI.Reference.csproj(UnoRuntimeIdentifier=Reference). There is noUno.UI.Wasm.csproj.src/Uno.CrossTargetting.targets:73is the only repo-source definition of__WASM__, gated on'$(UnoRuntimeIdentifier)'=='WebAssembly'. Neither head qualifies.Uno.UI.Runtime.Skia.WebAssembly.Browser.csprojdefinesWASM_SKIA(not__WASM__), and itsCompile Includelist is four.wasm.csfiles. The__WASM__define in that project'sbuild/*.targetsruns in the consuming app, never inUno.UI.IsOwnedByTextBlock()arm calls_collection.Owner, andDependencyObjectCollectionhas noOwnermember. That branch could not have compiled under any configuration in this tree.Every
!__WASM__body is kept verbatim — the focus-clearingClear()/RemoveAt(int), the indexer guard, andClearFocusForRemovedInline. The only prose change is dropping "Non-WASM" from a comment that no longer has a WASM flavour to contrast against.DoubleExtensions.csTwo
!XAMARINdirectives.XAMARINis defined only for the native Apple and Android targets (Uno.CrossTargetting.targets:91,95,96,105), none of whichUno.UIbuilds. Kept the!XAMARINbodies.Validation
#ifsymbols undersrc/Uno.UI. The remaining ones are in the WebView interop files thatUno.UI.Runtime.Skia.Android.csprojand.AppleUIKit.csproj<Compile Include>-link — live there, deliberately untouched. The ~76[Uno.NotImplemented("__ANDROID__", "__WASM__", …)]attribute strings are also untouched; they are data, not directives.dotnet build src/Uno.UI/Uno.UI.Skia.csprojandsrc/Uno.UI/Uno.UI.Reference.csproj, both with-p:UnoTargetFrameworkOverride=net10.0 -p:UnoFastDevBuild=true— 0 errors on both.Given_FocusManager_DetachedElementsandGiven_TextBlockcover the un-guarded focus path.PR Checklist ✅
Screenshots Compare Test Runresults.