Repository navigation
refactor: Remove the SamplesApp.Skia indirection layer - #24048
MartinZikmund merged 5 commits into
Conversation
|
Claude finished @MartinZikmund's task in 2m 55s —— View job PR Review: Remove SamplesApp.Skia indirection layerTasks:
SummaryThis is a well-motivated structural refactoring that eliminates the 2 issues found — 1 inline, 1 below. Inline comment
Non-diff finding (pre-existing line now orphaned)
Observations (no action needed)
|
| <linker> | ||
| <assembly fullname="SamplesApp" /> | ||
| <assembly fullname="SamplesApp.Skia" /> | ||
| <assembly fullname="SamplesApp" /> |
There was a problem hiding this comment.
Duplicate SamplesApp entry — SamplesApp was already on line 2 before this diff, and the replacement of SamplesApp.Skia on this line with SamplesApp produced two identical roots. Remove the second one.
| <assembly fullname="SamplesApp" /> |
There was a problem hiding this comment.
Pull request overview
This PR removes the SamplesApp.Skia indirection project and moves samples/unit-tests/benchmarks to compile directly into the multi-target SamplesApp head, making platform #if branches in samples compile on their respective targets.
Changes:
- Dropped
SamplesApp.Skia(project + solution/filter references) and removed relatedInternalsVisibleTogrants. - Updated
SamplesApphead project to import shared sample/test/benchmark content on all TFMs and to set Skia-related build properties on non-WinUI targets. - Cleaned up sample/test code paths that were previously hidden behind platform guards (e.g., removed obsolete native-view-based samples, qualified
WebView2references, adjusted assembly-name assumptions).
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UWP/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI.XamlHost/Properties/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI.slnx | Remove SamplesApp.Skia project entry. |
| src/Uno.UI.RuntimeTests/UITests/_Engine/RuntimeTestsApp.cs | Update sample assembly selection to SamplesApp vs UnoIslandsSamplesApp.Skia. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_FrameworkElement_And_Leak.cs | Simplify sample-assembly constant to SamplesApp. |
| src/Uno.UI.RuntimeTests/Directory.Build.props | Exclude nested helper projects’ obj/bin from globbing to avoid duplicate assembly attributes. |
| src/Uno.UI.RuntimeTests/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI.Dispatching/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI.Composition/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.UI-Skia-only.slnf | Remove SamplesApp.Skia from Skia-only filter. |
| src/Uno.Foundation/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/Uno.Foundation.Logging/AssemblyInfo.cs | Remove InternalsVisibleTo("SamplesApp.Skia"). |
| src/SamplesApp/SamplesApp/SamplesApp.csproj | Inline shared content into head for all TFMs; set Skia runtime identifier for non-WinUI; bring forward Skia build props/imports. |
| src/SamplesApp/SamplesApp/Platforms/WebAssembly/LinkerConfig.xml | Update linker roots for new assembly layout (but currently contains a duplicate entry). |
| src/SamplesApp/SamplesApp/Platforms/Android/Main.Android.cs | Adjust comment to reflect new generator/add-in visibility constraints. |
| src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Views/Behaviors/SplitViewBehavior.cs | Remove obsolete Android BindableDrawerLayout fallback branch. |
| src/SamplesApp/SamplesApp.Skia/SamplesApp.Skia.csproj | Deleted project (indirection layer removed). |
| src/SamplesApp/SamplesApp.Shared/App.xaml.cs | Simplify ICU data assembly resolution to typeof(App).Assembly. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml/UIElementTests/UIElement_Native_Child.xaml.cs | Remove obsolete native-view based sample code-behind. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml/UIElementTests/UIElement_Native_Child.xaml | Remove obsolete native-view based sample XAML. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml/UIElementTests/NativeView.cs | Remove Android native ScrollView implementation sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Media_Animation/SequentialAnimationsPage.xaml.cs | Remove Android-only new hiding for members that no longer exist. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/WebView/WebView_Input_Keyboard_Insets.xaml.cs | Remove obsolete Android-native-view-heavy sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/WebView/WebView_Input_Keyboard_Insets.xaml | Remove obsolete sample XAML. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/TextBox/Textbox_Keyboard_AutoFocus.xaml.cs | Collapse platform-specific focus code to shared focus path. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/TextBox/TextBox_Formatting_Flicker.xaml.cs | Remove Android-native IInputFilter / TextBoxView branch. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/TextBlockControl/TextBlock_TextWrapping_PR1954_EdgeCase.xaml.cs | Remove Android reflection-based native layout probing; update description text (typo remains). |
| src/SamplesApp/SamplesApp.Samples/Windows_Storage/Pickers/FileSavePicker_LargeFileWrite.xaml.cs | Retarget WASM-only picker configuration guard from __CROSSRUNTIME__ to __WASM__. |
| src/SamplesApp/SamplesApp.Samples/Toolkit/ElevatedView_Tester.xaml.cs | Remove Android-only new hiding for Elevation. |
| src/SamplesApp/SamplesApp.Samples/SamplesApp.Samples.csproj | Update comment to reflect samples now compile into head for all targets. |
| src/SamplesApp/SamplesApp.Samples/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_PostMessage_RemoveAdd.xaml.cs | Fully qualify Microsoft.UI.Xaml.Controls.WebView2 to avoid namespace conflicts. |
| src/SamplesApp/SamplesApp.Samples/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_MultiViews.xaml.cs | Fully qualify Microsoft.UI.Xaml.Controls.WebView2. |
| src/SamplesApp/SamplesApp.Samples/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_ContentDialogFocus.xaml.cs | Fully qualify Microsoft.UI.Xaml.Controls.WebView2. |
| specs/051-samplesapp-unosdk-skia/plan.md | Update plan to document Phase 7 and removal of SamplesApp.Skia. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| <assembly fullname="SamplesApp" /> | ||
| <assembly fullname="SamplesApp.Skia" /> | ||
| <assembly fullname="SamplesApp" /> | ||
| <assembly fullname="Uno.UI" /> | ||
| <assembly fullname="Uno.UI.Wasm.Tests" /> |
| namespace UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl | ||
| { | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "[Droid]Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] |
|
Tick the box to add this pull request to the merge queue (same as
|
bbff48d to
5425f9c
Compare
The samples, unit tests and benchmarks now build directly into the head rather than being consumed pre-compiled from SamplesApp.Skia on the Skia targets. Each target therefore compiles them with its own platform symbols, so a #if __ANDROID__ / __APPLE_UIKIT__ / __WASM__ branch in a sample page is finally live -- 26, 22 and 27 sample files respectively carried such branches, and none of them had ever been compiled. UnoRuntimeIdentifier is now Skia on every non-WinUI target, not just desktop and browserwasm. That is what defines __SKIA__ alongside the platform symbol. The csproj claimed this would make cross-targeting drop the head's own .Android.cs / .iOS.cs entry points; measured, it does not -- the file suffixes are gated on $(IsAndroid)/$(IsAppleUIKit), independently of the runtime identifier. Turning the guards on surfaced the code they had been hiding since native rendering was dropped: - NativeView / UIElement_Native_Child built a native Android ScrollView through Uno.UI's native-Views extensions, and WebView_Input_Keyboard_Insets was ~195 lines of native Android view code behind an otherwise empty Control. Both scenarios no longer exist; the samples are removed. - SplitViewBehavior kept a BindableDrawerLayout fallback, TextBox_Formatting_Flicker installed a native IInputFilter on TextBoxView, TextBlock_TextWrapping_PR1954_EdgeCase reflected into TextBlock's native LayoutBuilder, and Textbox_Keyboard_AutoFocus had native focus paths whose cross-platform #else already did the job. Those branches are gone; the samples keep working. - ElevatedView_Tester and SequentialAnimationsPage used `new` to hide native View members that no longer exist. - FileSavePicker_LargeFileWrite gated WASM-only picker configuration on __CROSSRUNTIME__, which mobile now also defines while referencing the netcoremobile flavor of Uno.UWP that does not carry those APIs. Retargeted to __WASM__. - Three WebView2 samples used the unqualified control name. The desktop target references the Microsoft.Web.WebView2 package, which puts a global WebView2 namespace in scope; the base library never referenced it, so co-locating the samples exposed the clash. Qualified (a using-alias cannot work against a global namespace of the same name -- CS0576). Also makes Uno.UI.RuntimeTests exclude its nested helper projects' obj/bin: the repo-wide exclusion is relative to the project directory, so once AlcApp, HRApp or HRUnoLib had been built their generated AssemblyAttributes.cs was compiled into the parent and failed with CS0579. Validated: net10.0-desktop and net10.0-android build clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DcqC3aauPNqhMqHvoZwNda
With the samples compiled into the head on every target, the intermediate
library has no remaining purpose. Its two reasons for existing are both gone:
it compiled the samples once as generic Skia (the head now does that per
target, with the platform symbols live), and it kept them out of the WinUI
compilation (the head already excluded it there).
Follow-on cleanup:
- Eight assemblies granted InternalsVisibleTo("SamplesApp.Skia"); every one of
them already grants "SamplesApp", so the grants simply go.
- App.xaml.cs picked the ICU data assembly by scanning loaded assemblies for a
name starting with "SamplesApp" while excluding "SamplesApp.Skia". The samples
are in the head now, so it takes typeof(App).Assembly directly.
- RuntimeTestsApp and Given_FrameworkElement_And_Leak selected between
"SamplesApp.Skia" and "SamplesApp.Wasm" per platform; both now resolve
"SamplesApp". Note RuntimeTestsApp built the islands name by prefixing
"UnoIslands", which only produced the right assembly while the suffix was
present -- that host is still UnoIslandsSamplesApp.Skia, so it is named
explicitly.
- The wasm LinkerConfig rooted the old assembly name.
- UnoDisableHotRestartHelperGeneration existed because the ApplicationDefinition
lived in the base library, leaving the generator nothing to bind to (Uno0005).
App.xaml is compiled into the head now, so the opt-out is removed -- verified
by building android without it.
Validated: net10.0-desktop, net10.0-android, net10.0-browserwasm (dotnet build)
and net10.0-windows10.0.19041.0 (MSBuild.exe) all build clean. Every solution
filter and Uno.UI.slnx checked for dangling project paths.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DcqC3aauPNqhMqHvoZwNda
Documents the SamplesApp.Skia removal, and corrects the Phase 6 note claiming the head could not compile the samples itself -- the constraint it described does not exist. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DcqC3aauPNqhMqHvoZwNda
0f852bc to
4cc68ae
Compare
|
Claude finished @MartinZikmund's task in 2m 43s —— View job PR Review: Remove SamplesApp.Skia indirection layerTasks:
SummaryThis is a well-executed structural refactoring. Removing the 2 inline comments + 1 non-diff finding, all minor: Inline comments posted
Non-diff finding — orphaned pragma
Observations (no action needed)
|
| <linker> | ||
| <assembly fullname="SamplesApp" /> | ||
| <assembly fullname="SamplesApp.Skia" /> | ||
| <assembly fullname="SamplesApp" /> |
There was a problem hiding this comment.
Duplicate linker root. SamplesApp is already declared on line 2; replacing SamplesApp.Skia with SamplesApp here produced two identical entries. Remove this line.
| <assembly fullname="SamplesApp" /> |
| namespace UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl | ||
| { | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "[Droid]Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] |
There was a problem hiding this comment.
Typo in sample description (pre-existing, but this line is touched by the PR): lenght → length.
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] | |
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text length and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] |
The head declares only platform-qualified TFMs, but targetframework-override.props assigned UnoTargetFrameworkOverride verbatim. Every platform-less value — net10.0 and net11.0, which is what the library layer builds and what the "Skia (Desktop, WebAssembly)" row of crosstargeting_override.props documents — therefore left the head on a TFM it does not have: $(_Platform) resolved to empty, every platform gate switched off, and the head silently lost its runtime and WinRT assemblies (14 of 26 ProjectReferences). It only ever worked on CI, which passes the platform-qualified form plus -f, neither of which Visual Studio can do. Map a platform-less override onto desktop, the flavor a plain TFM used to select back when desktop and wasm were separate projects, and strip the head-only desktop and browserwasm monikers for the library layer so a head-shaped override works repo-wide. Platform-qualified values still pass through untouched, so every CI leg resolves exactly as before — including the unversioned net11.0-ios its -f relies on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MhL4CfQQZ3bCQQQ5vCCiV2
The override table's "Skia (Desktop, WebAssembly)" row predates the unified head, where those are two target frameworks of one project rather than two projects. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MhL4CfQQZ3bCQQQ5vCCiV2
|
Claude finished @MartinZikmund's task in 4m 39s —— View job PR Review: Remove SamplesApp.Skia indirection layerTasks:
SummaryThe two newest commits address a real Visual Studio breakage: 2 inline comments posted; 1 non-diff finding in the summary. Inline comments posted
Non-diff finding — orphaned pragma
New-commit observations (no action needed)
|
64fdf86
into
dev/mazi/samplesapp-drop-old-heads
| <linker> | ||
| <assembly fullname="SamplesApp" /> | ||
| <assembly fullname="SamplesApp.Skia" /> | ||
| <assembly fullname="SamplesApp" /> |
There was a problem hiding this comment.
Duplicate linker root — SamplesApp is already declared on line 2. When SamplesApp.Skia was renamed to SamplesApp on this line the first entry was not removed, producing two identical <assembly fullname="SamplesApp" /> roots. The IL linker deduplicates by identity, so it won't cause a build failure, but it's confusing to maintain.
| <assembly fullname="SamplesApp" /> |
| namespace UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl | ||
| { | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "[Droid]Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] | ||
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] |
There was a problem hiding this comment.
Pre-existing typo in the sample description: lenght → length. This line is touched by the PR so it's cheap to fix now.
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text lenght and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] | |
| [Sample("TextBlock", Name = nameof(TextBlock_TextWrapping_PR1954_EdgeCase), Description = "Repro sample for PR1954. When the text is limited to 1 line, due to enough height available for 2 lines, it should take the size of 1 line only. You may need to adjust text length and/or container height depending on the device. Expected behavior: text should always be in the center of pink area")] |
GitHub Issue: relates to unoplatform/uno-private#2151 (internal: "Convert Samples app to Uno.Sdk", Platform 7.0) — Phase 7 of
specs/051-samplesapp-unosdk-skiaPR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
Removes the
SamplesApp.Skiaindirection layer. The samples, unit tests and benchmarks now compile directly into theSamplesApphead on every target.The point isn't just one fewer project. It's this:
The samples only ever built twice — as generic Skia (in the base library) and as WinUI (in the head's windows target). So
WINAPPSDKworked, and 26 files with#if __ANDROID__, 22 with__APPLE_UIKIT__and 27 with__WASM__were dead code. You could write a platform fix in a sample and it would silently never run. Now every target compiles the samples with its own symbols.The blocker that wasn't
#24046 recorded that the head couldn't take this over, because its mobile targets compile in native mode for their own
.Android.cs/.iOS.csentry points. That was wrong — and the csproj comment asserting it was wrong the same way itsUnoRuntimeIdentifiercomment had been.Measured: with
UnoRuntimeIdentifier=Skiaonnet11.0-android,DefineConstantscarries__SKIA__,__CROSSRUNTIME__and__ANDROID__/__UNO_SKIA_ANDROID__together, and all three.Android.csentry points are still inCompile. The file suffixes are excluded on$(IsAndroid)/$(IsAppleUIKit), independently of the runtime identifier.What the live guards surfaced
Cost of turning them on: 1 file on desktop, 9 on android — all native-Views-era code orphaned by the native rendering drop.
NativeView+UIElement_Native_ChildScrollViewvia Uno.UI's native-Views extensions — removedWebView_Input_Keyboard_InsetsControl— removedSplitViewBehaviorBindableDrawerLayoutfallback — branch removedTextBox_Formatting_FlickerIInputFilteronTextBoxView— branch removedTextBlock_TextWrapping_PR1954_EdgeCaseTextBlock's nativeLayoutBuilder— branch removedTextbox_Keyboard_AutoFocus#elsealready worked — collapsedElevatedView_Tester,SequentialAnimationsPagenewhiding nativeViewmembers that no longer existFileSavePicker_LargeFileWrite__CROSSRUNTIME__, which mobile now defines while referencing the netcoremobile flavour ofUno.UWPthat lacks those APIs — retargeted to__WASM__WebView2_*WebView2. The desktop target references theMicrosoft.Web.WebView2package, which puts a globalWebView2namespace in scope; the base library never referenced it, so co-locating the samples exposed the clash. A using-alias can't fix it (CS0576 against a global namespace) — the type is qualifiedOnly the two fully-native samples were lost. Everything else kept working.
Cleanup that followed
InternalsVisibleTo("SamplesApp.Skia")grants — all eight assemblies already grantSamplesApp.App.xaml.cspicked the ICU data assembly by scanning loaded assemblies for a name starting withSamplesAppwhile excludingSamplesApp.Skia; now justtypeof(App).Assembly.RuntimeTestsAppandGiven_FrameworkElement_And_Leakchose betweenSamplesApp.SkiaandSamplesApp.Wasm.RuntimeTestsAppbuilt the islands name as"UnoIslands" + assemblyName, which only produced the realUnoIslandsSamplesApp.Skiawhile the samples assembly still carried the suffix — now named explicitly.UnoDisableHotRestartHelperGenerationexisted because theApplicationDefinitionlived in the base library (Uno0005).App.xamlcompiles into the head now, so it's gone — verified by building android without it.Uno.UI.RuntimeTestsnow excludes its nested helper projects'obj/bin. The repo-wideDefaultItemExcludesisobj/**, relative to the project directory, so onceAlcApp/HRApp/HRUnoLibhad been built their generatedAssemblyAttributes.cswas compiled into the parent (CS0579). Pre-existing; it blocked this work repeatedly.Validation
net10.0-desktopdotnet buildnet10.0-androiddotnet buildnet10.0-browserwasmdotnet buildnet10.0-windows10.0.19041.0MSBuild.exe -rAll six solution filters and
Uno.UI.slnxverified free of dangling project paths.__APPLE_UIKIT__branches (22 files) compile for the first time on CI, and I can't build them on Windows. Expect the same class of fallout as android — dead native-UIKit code. I pre-emptively cleaned the ones visible by inspection, but this needs a CI run to be sure.PR Checklist ✅
specs/051-samplesapp-unosdk-skia/plan.mdPhase 7 records the measurements and watch-outsScreenshots Compare Test Runresults (pending CI)