Skip to content

Tizen core backend vertical slice on the public MAUI ViewHandler - #5

Merged
Redth merged 44 commits into
mainfrom
redth-tizen-core-vertical-slice
Aug 28, 2026
Merged

Redth merged 44 commits into
mainfrom
redth-tizen-core-vertical-slice

Conversation

@Redth

@Redth Redth commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Stacked on redth-tizen-foundation-import (merged at 79aa0f3). Review that PR first.

Implements the first runtime layer of the standalone Tizen backend: a working vertical slice of
application → window → page → content view → layout → label, plus the dispatcher, ticker,
IMauiContext and lifecycle plumbing those handlers need.

What's here

src/Maui.Tizen.Core, namespace Microsoft.Maui.Platforms.Tizen:

Area Types
Handler base TizenViewHandler<TVirtualView, TPlatformView>, ITizenPlatformViewHandler
Handlers TizenApplicationHandler, TizenWindowHandler, TizenContentViewHandler, TizenPageHandler, TizenLayoutHandler, TizenLabelHandler
Platform views TizenContentViewGroup, TizenLayoutViewGroup, TizenLabelView
App / lifecycle TizenMauiApplication, TizenCoreApplicationExtensions, TizenLifecycle, TizenLifecycleBuilderExtensions, TizenLifecycleEventExtensions
Dispatching TizenDispatcher, TizenDispatcherTimer, TizenDispatcherProvider
Animation TizenTicker
Hosting UseMauiAppTizen<TApp>(), ConfigureTizen(), AddTizenHandlers(), AddTizenPageHandler<TPage>()
Platform helpers TizenPlatformExtensions, TizenMauiContext, TizenDisplayDensity, TizenLayoutExtensions

TizenViewHandler<,> derives from MAUI's public generic
Microsoft.Maui.Handlers.ViewHandler<TVirtualView, TPlatformView>. No MAUI partial class is copied,
no competing Microsoft.Maui.Handlers.ViewHandler is declared, and every ported type that would
have collided was renamed (MauiApplication → TizenMauiApplication, PlatformTicker →
TizenTicker, Dispatcher → TizenDispatcher, IPlatformViewHandler →
ITizenPlatformViewHandler). There is no CS0433 risk for consumers that also reference MAUI's
Tizen build.

Also adds samples/Maui.Tizen.Sample, a Core-level head with Platforms/Tizen/Main.cs and a
tizen-manifest.xml at api-version="11".

How this is verified, given the workload gate

net11.0-tizen11.0 cannot be restored by anyone until Samsung publishes
samsung.net.sdk.tizen.manifest-11.0.100, and per the repository contract this PR does not add
a neutral fallback. Instead two projects compile the same sources:

  • tests/Maui.Tizen.Core.UnitTests — compiles the backend against inert stand-ins for
    Tizen.NUI and executes 102 tests: mapper and command-mapper registration (including a test
    that locks the Add/Remove/Clear/Insert/Update/UpdateZIndex command keys MAUI Controls
    raises by string), DI and handler registration through UseMauiAppTizen, dispatcher/timer/
    provider semantics, density conversion, layout z-index ordering, and IMauiContext scoping.
  • tests/Maui.Tizen.Core.RefPackCompile — type-checks every #if TIZEN source, and the
    sample's managed code, against the real TizenFX reference assemblies from
    Samsung.Tizen.Ref.API15 (ref/net8.0). Compile-only, IsPackable=false, reference-only
    assemblies, so it can never become a shippable neutral build.

Both are wired into eng/build-workload-free.sh and pass in Release with
ContinuousIntegrationBuild=true (i.e. TreatWarningsAsErrors). The product project and the sample
still fail with the foundation's MAUITIZEN0001, as intended.

No device build has been performed and none is claimed.

Blockers

  1. Samsung workload manifest for the 11.0.100 band does not exist. External, no workaround.
  2. Tizen.UIExtensions.NUI 0.9.2 must not ship — it declares Microsoft.Maui.Graphics
    6.0.300-rc.3.1336. Version is centrally managed, Microsoft.Maui.Graphics is pinned explicitly,
    and MAUITIZEN0101 refuses to pack until it is bumped.
  3. eng/build-workload-free.sh reports the workload as installed when it is not. MSBuild detection
    is correct, so nothing builds that shouldn't — flagged, not changed (foundation-owned).

Public MAUI API gaps this uncovered

Full detail in docs/net11-status.md. Summary:

# Gap Consequence here
G1 ViewHandler.ContainerView setter is private protected, yet SetupContainer() is protected abstract Containers are impossible externally. NeedsContainer => false; gradient/image backgrounds, clip and shadow via WrapperView are unavailable.
G2 ILabelHandler/IContentViewHandler/ILayoutHandler/IWindowHandler bind PlatformView to a per-TFM alias — and to MAUI's own platform types on -tizen Cannot be implemented (CS9333, CS0738). Backend declares its own ITizen*Handler interfaces; Controls interop preserved via identical command-mapper key strings.
G3 MauiContext.AddSpecific / AddWeakSpecific are internal TizenMauiContext implements IMauiContext directly.
G4 LifecycleEventServiceExtensions.InvokeLifecycleEvents(IServiceProvider, …) is internal Ported as InvokeTizenLifecycleEvents.
G5 Microsoft.Maui.Handlers.LayoutExtensions is internal OrderByZIndex / GetLayoutHandlerIndex ported verbatim (and unit tested).
G6 HandlerNotFoundException is internal Replaced with InvalidOperationException.
G7 The Microsoft.Maui.Platform.*Extensions Tizen surface is public but TFM-locked to MAUI's own assembly Ported into TizenPlatformExtensions; this is the bulk of the remaining work for the other handlers.
G8 dotnet/maui still calls Tizen.NUI.Window.Instance, deprecated in API12 Uses Window.Default. Found by the reference-pack lane.
G9 IFontManager has no cross-platform font-family resolution UpdateFont uses Font.Family directly; IFontRegistrar aliases unresolved.

Constraints honoured

No private reflection, no DispatchProxy, no MAUI source project references, no InternalsVisibleTo
from MAUI, no duplicated neutral MAUI type names. MainThread.tizen.cs is deliberately not
ported — MainThread flows through the .NET 11 dispatcher bridge because UseMauiAppTizen
registers TizenDispatcherProvider as IDispatcherProvider.

Redth and others added 2 commits August 26, 2026 15:20
Implements the first runtime layer of the standalone Tizen (NUI) backend:
Tizen-prefixed application, window, page, content view, layout and label
handlers built on MAUI's public generic ViewHandler<TVirtualView, TPlatformView>,
plus the dispatcher, ticker, MauiContext and lifecycle plumbing they need.

Nothing uses private reflection, DispatchProxy, MAUI source project references
or InternalsVisibleTo, and no neutral MAUI type name is re-declared, so there is
no CS0433 risk for consumers that also reference MAUI's Tizen build.

Verification, since net11.0-tizen11.0 cannot be restored without the Samsung
workload:
 - tests/Maui.Tizen.Core.UnitTests compiles the backend against inert stand-ins
   and executes 102 tests covering mapper/command-mapper registration, DI and
   handler registration, hosting, dispatcher semantics, density conversion,
   layout z-index ordering and IMauiContext scoping.
 - tests/Maui.Tizen.Core.RefPackCompile type-checks every #if TIZEN source, and
   the sample head, against the real TizenFX reference assemblies from
   Samsung.Tizen.Ref.API15.
 - The product project and sample fail with an actionable MAUITIZEN0001 rather
   than degrading to a neutral target framework.

Blockers and the public MAUI API gaps this work uncovered are recorded in
docs/net11-status.md.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reconciles the core vertical slice with the committed foundation contract:

 - Maui.Tizen.Core now derives its shape from eng/targets/TizenPackage.props and
   the IsTizenProject convention, so the single net11.0-tizen11.0 target framework,
   the TIZEN define and the MAUITIZEN0001 workload gate all come from the
   foundation rather than being duplicated locally.
 - Because most of src/Maui.Tizen.Core is still raw imported dotnet/maui source
   that cannot compile from here, the project opts in only the ported slice, via
   eng/Maui.Tizen.Core.Sources.props, and removes those files from the <None>
   glob so each appears exactly once.
 - All package versions moved to the foundation's central package management.
 - Both verification lanes were added to eng/build-workload-free.sh and pass in
   Release with ContinuousIntegrationBuild=true.

Compiling against the API15 reference pack under TreatWarningsAsErrors also
surfaced that dotnet/maui's Tizen sources still use Tizen.NUI.Window.Instance,
deprecated in API12; this backend uses Window.Default.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Redth and others added 3 commits August 26, 2026 15:36
…ad gate

Re-validated the slice against the advanced base (concrete global.json SDK pin,
Node 24 actions, baseline exclusion notes). Both verification lanes still pass in
Release with ContinuousIntegrationBuild=true, and CI is green on the merge.

Also replaces a claim in docs/net11-status.md that was too vague to act on, with
measurements:

 - Overriding the gate on SDK 11.0.100-preview.7.26381.103 yields NETSDK1013 for
   net11.0-tizen11.0, so the missing Samsung manifest really is the only thing in
   the way.
 - MAUI's own maui-tizen workload DOES exist in the 11.0.100 band and reports as
   installed, but its manifest entry is {"extends": ["maui-blazor"]} with no
   packs and no reference to Samsung's workload, so installing it changes nothing.
 - That matters for eng/build-workload-free.sh, whose gate check greps for the
   substring 'tizen' and therefore matches maui-tizen. It will announce that the
   Tizen lane can be promoted to required while the build still fails. CI only
   reports correctly today because its agents have no workloads installed at all.
   The MSBuild-side probe in Directory.Build.props is correct; only the script's
   advisory line is wrong, so nothing builds that should not.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ran a review of this branch's diff against the upstream Tizen implementation
before handing over for independent review. Six real problems, all fixed:

1. UpdateBackground(Paint?) cleared to transparent on a null paint. The
   reference returns early. This mattered: TizenPageHandler paints a page
   opaque white at creation and then runs the background mapper, so every page
   with no explicit Background was being repainted transparent at launch.

2. Window UpdateX/Y/Width/Height had the data flow backwards - they pushed MAUI
   values into the NUI window, which Tizen does not permit, and never called
   IWindow.FrameChanged. The cross-platform window therefore never learned its
   own size, and since these mappers only run at handler init it was not
   recoverable later. Now matches the reference's UpdateUnsupportedCoordinate.

3. SetMainContent added content without removing the previous content, so
   re-assigning IWindow.Content left the old view parented and visible under the
   new one and leaked its NUI subtree. Now tracked per window and replaced.

4. Window.Initialize and SetWindowCloseRequestHandler had been dropped, leaving
   the hardware back key inert, rotation unregistered and no path to Exit(). The
   workable subset is now ported: four orientations, KeyEvent routed to
   IWindow.BackButtonClicked(), falling through to the close handler. The modal
   NavigationStack remains out of scope and is now documented as such.

5. ITicker was transient and IAnimationManager singleton; the reference scopes
   both. TizenTicker is IDisposable and owns a Timer, so a transient resolved
   from the root provider is retained for the process lifetime, and a singleton
   AnimationManager pinned every animation callback to whichever thread resolved
   it first, because TizenTicker captures SynchronizationContext.Current.

6. HandlersUseTheirOwnMapperByDefault asserted only that a `new T()` expression
   is non-null,
   which is unconditionally true - it would have passed even for the regression
   it was named after.

The replacement for (6) is mutation-tested rather than assumed: constructing
TizenLabelHandler with MAUI's mapper makes it fail, because MAUI's mapper casts
the handler to MAUI's ILabelHandler, which this backend deliberately does not
implement. Setting a virtual view is load-bearing - PropertyMapper short-circuits
on a null virtual view and the assertion would pass vacuously without it. The new
DI lifetime guard was mutation-tested the same way.

105 tests pass, the reference-pack compile lane is clean, and
eng/build-workload-free.sh is green.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Redth
Redth force-pushed the redth-tizen-core-vertical-slice branch from d0517f9 to e414bc5 Compare August 26, 2026 20:03
Redth added a commit that referenced this pull request Aug 26, 2026
…policy

Ten further review findings. All were real; several were things that looked
correct while doing nothing.

Blazor package graph (verified against the feed, not assumed)

Microsoft.AspNetCore.Components.WebView was pinned to MAUI's version stamp
11.0.0-preview.7.26418.3. That version does not exist for that package - it is an
ASP.NET Core package on its own version line - so NuGet silently substituted
11.0.0-rc.1.26378.118 (NU1603) and then failed with NU1109 downgrades across the
graph. That substitution is where the "actual dependency is rc.1" report came
from; it was NuGet's fallback, not a declared dependency.

Microsoft.AspNetCore.Components.WebView.Maui 11.0.0-preview.7.26418.3 declares
Microsoft.AspNetCore.Authorization, Microsoft.AspNetCore.Components.WebView and
Microsoft.JSInterop at exactly 11.0.0-preview.7.26381.103 - which also matches the
SDK build pinned in global.json, so the whole graph stays on one ASP.NET Core
build. Pinned there. RC1 would have silently upgraded past what MAUI asked for.

Package source mapping now lists the prerelease patterns under BOTH sources.
NuGet restores only from sources declaring the longest matching pattern, so
Microsoft.AspNetCore.* under dotnet11 alone would have made every ASP.NET Core
package resolvable only from that feed (NU1100 for anything it lacks).

Added eng/tests/PackageGraphProbe: a net11.0 project whose only purpose is to make
restore prove these pins resolve. Necessary because the real consumers are Tizen
projects, and they cannot restore at all - the workload gate fires before Restore
- so a broken pin would otherwise stay invisible until Samsung ships. Verified it
reproduces the original NU1603/NU1109 failure.

CI workload probe could never succeed (#5)

`dotnet workload install tizen --skip-manifest-update` cannot work on a clean
runner: the Samsung manifest is third-party and side-loaded, so the workload ID is
not discoverable through public workload search, and --skip-manifest-update
guarantees failure because the manifest is exactly what is missing. A probe that
can never succeed would keep reporting "blocked" for weeks after the gate lifts.
Replaced with a feed probe for an 11.0.100-band manifest package, checking both ID
spellings. Installation, when it happens, goes through Samsung's supported path.

Dead configuration removed (#6, #10)

  - <Compile Update="**/*.Tizen.cs" /> had no metadata, so it changed nothing, and
    EnableDefaultCompileItems=false meant there were no items to update anyway. It
    read as meaningful configuration while being unreachable.
  - ValidateBaselineConsistency did substring matching on JSON inside MSBuild.
    Parsed validation already exists in the workload-free script and the invariant
    tests, which is where it belongs.

Orphan imported projects (#7)

GraphicsTester.Skia.Tizen.csproj was imported because its filename contains
"Tizen", but it cannot load here: its TFM is $(_MauiDotNetTfm)-tizen (a
dotnet/maui property that does not exist here, so the TFM evaluates to the
malformed "-tizen") and both ProjectReferences point at projects never imported.
Parked as .csproj.orphan - file and history intact, invisible to project
discovery - with samples/README.md documenting every orphan asset directory and an
invariant test asserting every .csproj is in the solution.

Analyzers and warnings (#8, #14)

  - Added Microsoft.CodeAnalysis.PublicApiAnalyzers (PrivateAssets=all) so the
    PublicAPI baselines are enforced rather than inert text.
  - Removed the Microsoft.SourceLink.GitHub pin; the SDK has bundled it since .NET 8.
  - Suppressed CS1591 in TizenPackage.props: the inherited sources are not
    uniformly documented, so the first project to start compiling would otherwise
    fail on hundreds of missing-comment errors under warnings-as-errors.
    Documentation is its own workstream, not a blocker for the first handler.

Licensing (#9)

git-filter-repo is vendored and load-bearing, so unlike the referenced-only
Samsung packages it IS redistributed. Added its upstream, version, MIT licence
text and a verification command to THIRD-PARTY-NOTICES.md.

CI hygiene (#11, #12)

  - `dotnet test --no-build` is skipped when a preceding build failed; running it
    against missing output buries the actual first failure in cascading noise.
  - Added a scheduled dependency-audit workflow. The strict policy stays (audit at
    `low`, warnings as errors - this ships to devices where patching is slow), but
    a newly published advisory now files an issue weekly instead of ambushing
    whoever opens the next unrelated PR. Suppression process documented, with a
    required justification and re-review date.

Naming and provenance (#13)

Replaced 'samsung.net.sdk.tizen.manifest-11.0.100' with the actual band contract
Samsung.NET.Sdk.Tizen.Manifest-11.0.100-preview.7, recording both ID spellings
(NuGet IDs are case-insensitive) and the probe results for each. Documented that
tizen11.0/API15 comes from Samsung workload PR #310 - verified, not assumed.

Also recorded that enabling Build.Tasks raises real SkiaSharp native-asset
packaging questions, flagged as an open decision rather than papered over.

Tests: 28 -> 33 invariants, plus the package graph probe wired into the required lane.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Redth and others added 12 commits August 26, 2026 16:22
CI failed the new workload-detection regression on this branch while passing on
the foundation branch, and passed locally. The cause was UseMaui=true on
Maui.Tizen.Core.

UseMaui makes the SDK require the maui workload before it will restore. On a
machine that has it installed - mine - restore proceeds and MAUITIZEN0001 fires
normally. On a machine that does not - CI - the SDK fails first with NETSDK1147
asking for the workload, so the repository's own explanatory gate never runs.
eng/tests/test-workload-detection.sh caught exactly that: neither MAUITIZEN0001
nor a raw NETSDK1013 appeared in the output.

Maui.Tizen.Core is a class library that consumes Microsoft.Maui.Core as a
package, not an application head, so it has no reason to set UseMaui or
SingleProject. Both stay on samples/Maui.Tizen.Sample, where they mean something.

Worth recording as a general point for this migration: turning UseMaui on for a
backend package silently swaps this repository's actionable external gate for a
generic workload error, on precisely the machines least equipped to interpret it.

Also merges the foundation head (package graph probe, dependency audit workflow,
build-ordering fix in build-workload-free.sh) and re-runs the full workload-free
lane, which is green including the detection regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Re-validated the whole slice against the bumped package baseline. No source
changes were needed: 105 slice tests pass, the reference-pack compile lane is
clean under CI semantics, and eng/build-workload-free.sh is green end to end,
including the workload-detection regressions.

Confirmed all six self-review fixes survived the merge intact (null-paint no-op,
FrameChanged reporting, window content replacement, back-key and rotation
wiring, scoped ticker/animation manager, and the mutation-tested mapper guard),
along with docs/net11-status.md in full.

Also refreshes the package-baseline section of docs/net11-status.md, which still
cited 26418.3. It now records that these packages are built from bedd1b18b7 -
46 commits ahead of the ee4d06cde6 source pin - and points at eng/baselines.json
for why that gap is one-directional and does not affect this slice.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Core architecture and code review found a set of defects that shared a
characteristic: each one leaves the build green and the tests passing while the
product silently does nothing at runtime. Fixed, each with a regression that was
mutation-tested rather than assumed.

1. DI precedence (merge blocker). ConfigureTizen used TryAdd, but
   MauiApp.CreateBuilder defaults to useDefaults:true and MAUI's
   ConfigureDispatching/ConfigureAnimations run first, so every Tizen platform
   service lost to a neutral default. Reproduced before fixing: the resolved
   provider was Microsoft.Maui.Dispatching.DispatcherProvider. Now registered
   with Replace at the correct lifetimes - provider singleton, dispatcher,
   ticker and animation manager scoped. IApplication stays on TryAdd so a host
   registration still wins.

   The dispatcher registration also publishes the provider through
   DispatcherProvider.SetCurrent. That is load-bearing: MainThread resolves via
   the STATIC provider, not through DI, so replacing only the DI registration
   would have left MainThread on the neutral provider and still failed silently.

   Every hosting test now runs against both useDefaults values. The old suite
   used useDefaults:false exclusively, which is exactly why this survived.

2. DispatchDelayed was a repeating timer cancelled by disposing from inside its
   own callback - after posting. Now one-shot. The regression is deterministic
   rather than probabilistic: it drives a SynchronizationContext whose Post
   blocks, which is the condition under which the original re-fires. My first
   attempt at this test passed against the unmodified original, so it was
   rewritten until it actually failed.

3. The sample set IsTizenProject but did not import TizenPackage.props in the
   props phase, so it evaluated an EMPTY TargetFramework and produced no inner
   build at all, with no error. Pinned by an evaluation-level test that shells
   out to msbuild -getProperty, since nothing at compile or run time can see it.

4. Handlers chained MAUI's neutral ViewHandler.ViewMapper, which off-platform is
   compiled with PlatformView aliased to object and dispatches to Standard
   no-ops - so every generic IView property resolved and did nothing. Added a
   Tizen-owned base mapper covering visibility, enabled, input transparency,
   size constraints, transforms and anchors, clip, shadow, background, flow
   direction, semantics, automation, focus/unfocus and invalidate. The tests
   assert that a mapper RAN, because a key-presence test cannot distinguish a
   working mapper from a no-op one.

5. TizenPackage.props attached ~3,270 lines of dotnet/maui's inherited
   Microsoft.Maui.* PublicAPI baselines to this assembly, whose surface is
   entirely different; with the analyzer referenced the real product build would
   fail RS0016/RS0017 wholesale. Scoped to slice-specific baselines and the
   analyzer now runs over the real product sources in the ref-pack lane. RS0016
   remains suppressed with the reason recorded, because the surface cannot be
   enumerated until the assembly can be built; RS0017 stays enabled, which is
   the check that catches the inherited baselines being re-attached.

6. Nothing bridged CoreApplication's lifecycle onto IWindow, so Created,
   Activated, Deactivated, Stopped, Resumed and Destroying never fired. Added
   TizenWindowLifecycleBridge, kept deliberately platform-independent so it is
   unit testable, with activate/deactivate balanced because Tizen can deliver
   OnResume without a preceding OnPause.

7. MakeWindowScope never ran IMauiInitializeScopedService implementations.

8. SetMainContent unparented the previous native view but left its handler
   holding the platform view, its subscriptions and its child handler graph, so
   the whole previous page leaked on every content swap.

9. Clearing a background to null left the old native colour on screen. Ordinary
   views now clear; pages deliberately do not, because a page is created opaque
   white and then has the mapper run over it - clearing there would repaint every
   page transparent at launch.

174 tests pass, the ref-pack compile lane is clean under CI semantics, and
eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ecycle order

Four findings from the final core review. Each was reproduced before being
fixed, and each fix is pinned by a mutation-tested regression.

1. PublicAPI baselines were empty with RS0016 suppressed, which is not a
   solution - it lets any new public API land unbaselined. The baselines are now
   real and RS0016 is not suppressed anywhere.

   They were generated by the analyzer's own code fix rather than transcribed:

     dotnet format analyzers tests/Maui.Tizen.Core.RefPackCompile/... \
       --diagnostics RS0016 --severity warn

   That runs against the exact product sources compiled against real TizenFX, so
   the 356 product entries are the genuine emitted surface. I first tried
   generating them by reflecting over the assembly; the output was close but not
   byte-exact (nullability annotations and optional-parameter defaults), and a
   baseline that is nearly right is worse than none, so that approach was
   abandoned rather than patched up.

   The sample's 145 entries live in samples/Maui.Tizen.Sample/PublicAPI/ so the
   product baseline describes only what the package would ship. Verified by
   mutation: adding an unbaselined public method produces RS0016.

2. The ZIndex command chain was broken at both ends. MAUI Controls raises
   Invoke(nameof(IView.ZIndex)) on the CHILD's handler; the child's mapper is
   supposed to forward to the parent layout as
   Invoke(nameof(UpdateZIndex), view), passing the IView itself. This backend's
   child command mapper had no ZIndex entry at all, and the parent's mapper
   expected a LayoutHandlerUpdate - so even a fixed child would have been
   dropped. Both halves are mutation-tested independently.

3. DispatcherProvider.Current was only correct by accident. Measured after
   Build(): useDefaults:true gave the Tizen provider, because MAUI's
   ApplicationDispatcherInitializer resolves IDispatcher at Build time as a side
   effect; useDefaults:false left the neutral provider in place, silently, and
   MainThread would have been dead. Added TizenDispatcherProviderInitializer, an
   IMauiInitializeService that publishes it explicitly. The test asserts on the
   state immediately after Build() with no test-only resolve, since a real app
   never primes it by hand.

4. Lifecycle order was wrong: Activated came from OnCreate. Tizen always
   delivers OnResume after OnCreate, and MAUI's contract elsewhere is
   Created -> Resumed -> Activated. OnCreate now raises only Created, and a
   full-sequence regression pins the whole order including the pause/resume
   round trip.

194 tests pass, the analyzer reports zero diagnostics over the real product
sources, and eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The push of 86e6db2 did not produce a pull_request-triggered run, so PR #5 was
left reporting no checks. The workflow_dispatch run on that exact SHA passed;
this empty commit re-triggers the PR lane so the check status is attached to the
pull request itself.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The architecture review is correct and my G2 finding was wrong. Verified by
reflection over Microsoft.Maui.dll from Microsoft.Maui.Core 11.0.0-preview.7.26426.4
(lib/net11.0), which is what this repository actually compiles against:

  ILabelHandler.PlatformView       -> System.Object
  ILayoutHandler.PlatformView      -> System.Object
  IContentViewHandler.PlatformView -> System.Object
  IWindowHandler.PlatformView      -> System.Object

PlatformView is object, not a per-TFM alias, and the interfaces are implementable
out of repo - confirmed by compiling a handler against the published package.

What actually happened: the CS9333 I diagnosed came from my own explicit
interface implementation returning the concrete platform type rather than object.

  TizenLabelView ILabelHandler.PlatformView => PlatformView;   // CS9333
  object ILabelHandler.PlatformView => PlatformView;           // correct

The compiler was reporting a mistake in this backend, not a limitation in MAUI,
and I drew a much larger conclusion from it than it supported.

Consequences:

 - The parallel ITizenLabelHandler / ITizenContentViewHandler / ITizenPageHandler
   / ITizenLayoutHandler / ITizenWindowHandler hierarchy is removed. The handlers
   implement MAUI's ILabelHandler, IContentViewHandler, IPageHandler,
   ILayoutHandler and IWindowHandler directly.

 - Two backend-owned interfaces remain, each for a stated reason:
   ITizenApplicationHandler, because MAUI Core ships no IApplicationHandler at
   all; and ITizenPlatformViewHandler, for native parenting and disposal.

 - Mappers are now typed against MAUI's handler interfaces and chain MAUI's
   static mappers. That is what unblocks Controls: RemapForControls mutates the
   STATIC LabelHandler.Mapper, so a backend can only observe those entries by
   chaining that same instance, which requires the interface typing.

 - Chain order is deliberate - own entries, then TizenViewMappers, then MAUI's
   static mapper. Tizen behaviour still wins for keys this backend implements
   (MAUI's neutral bodies are no-ops and must not shadow it), while keys that
   exist only because Controls remapped them remain reachable. Both halves are
   asserted.

ControlsRegistrationTests adds concrete coverage: Label, ContentPage,
VerticalStackLayout, Grid and Window all resolve to the Tizen handlers under
UseMauiApp, the resolved handlers construct, every Controls-only mapper key
resolves through the chain, and no parallel ITizen* handler interface remains
beyond the two justified ones.

docs/net11-status.md G2 is rewritten as an explicit retraction rather than
deleted, so the record shows what was claimed, what was measured, and why the
original conclusion was wrong. The PublicAPI baselines were regenerated from the
analyzer's own code fix against the new surface (337 product entries).

All previously assigned fixes are preserved: PublicAPI baseline, ZIndex chain,
MainThread initialization, lifecycle ordering, and the Tizen base view mapper.

207 tests pass, the analyzer reports zero diagnostics over the real product
sources, and eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CI on d32ba3c failed TizenBaseMapperCoversMauisViewMapperExceptDocumentedExclusions
while the same test passed locally. The cause was a genuine order dependency, not
flakiness: MAUI Controls' RemapForControls mutates the STATIC
ViewHandler.ViewMapper at runtime, so whether the Controls-added keys were present
depended on whether some earlier test had touched a Controls type. Adding the
Controls package reference for the new registration tests is what exposed it.

Fixed at the root rather than by widening the exclusion list:

 - TizenViewMappers.ViewMapper now chains MAUI's static ViewHandler.ViewMapper.
   That is the only way an out-of-repo backend can observe Controls-remapped
   entries. Own entries are still checked first, so the real Tizen bodies keep
   winning over MAUI's neutral no-op ones - asserted by the existing behavioural
   suite, which still passes in full.

 - IView.Semantics is now genuinely implemented against NUI's AccessibilityName,
   AccessibilityDescription and AccessibilityHighlightable. dotnet/maui's Tizen
   UpdateSemantics is an empty stub, but TizenFX API15 does expose these, and
   Controls funnels Description, Hint, HeadingLevel, IsInAccessibleTree and
   ExcludedWithChildren back through this one key - so an inert mapper silently
   discards every accessibility annotation an app sets. This is an improvement on
   upstream rather than a port of it.

 - The test now forces Controls initialization before comparing, so it can no
   longer pass or fail depending on test ordering. Verified by running it in
   isolation, which is the exact configuration that failed in CI.

 - The exclusion list is unchanged and still contains only ContainerView and
   Border, both blocked by the container-view gap in G1.

Worth recording: BackgroundColor and BackgroundImageSource were already reachable
through the handler mapper chain before this change - I measured which of the
missing keys were genuinely unreachable and the answer was none of them. Chaining
the view mapper makes that reachability structural rather than incidental, and
the new tests pin each key individually.

215 tests pass, the analyzer reports zero diagnostics over the real product
sources, and eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Wave C's remaining Core-owned primitives, ported so the raw imported originals
never need to be compiled:

  src/Core/src/Platform/Tizen/MauiToolbar.cs             -> TizenToolbarView
    (also IToolbarContainer                              -> ITizenToolbarContainer)
  src/Core/src/Platform/Tizen/StackNavigationManager.cs  -> TizenStackNavigationManager
  src/Core/src/Platform/Tizen/NaviPage.cs                -> TizenNaviPage

NaviPage was not in the assignment. StackNavigationManager cannot compile without
it, and it is the highest-collision-risk of the three because upstream declares it
in the NEUTRAL Microsoft.Maui namespace rather than Microsoft.Maui.Platform.
Porting it was the only way to keep the raw original out of the build.

Every type was renamed rather than kept: MauiToolbar, StackNavigationManager and
NaviPage all exist in the net*-tizen build of Microsoft.Maui.dll, so reusing those
names is a CS0433 hazard for any consumer referencing both assemblies.

Navigation behaviour is preserved exactly - initial stack realisation, push-to-sync,
pop-to-sync and same-top back-stack reconciliation, including disposing each
departing page's handler rather than only unparenting its native view, which is
what stops popped pages leaking their whole child handler graph.

No Wave C handler was added to this package, and CorePlatformPrimitiveTests
asserts that none has leaked in.

These types derive from real NUI views, so they cannot be constructed on the host
and their behaviour is type-checked by the reference-pack lane instead. The unit
tests therefore pin what a compile cannot: that the types exist under the agreed
names, are wired into the explicit source lanes, appear in the package PublicAPI
baseline, expose the exact members Wave C codes against, and that the superseded
imported files stay uncompiled.

Supersession is recorded in eng/Maui.Tizen.Core.Sources.props next to the compile
items and in docs/net11-status.md. The manifest data file under eng/manifests/ is
still only a schema - it is generated by foundation-owned inventory tooling - so
there was nothing there for me to update without inventing it.

238 tests pass, the analyzer reports zero diagnostics (367 product API entries),
and eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Wave C's expanded Core primitive set:

  MauiFlyoutView.cs        -> TizenFlyoutView
  MauiTVFlyoutView.cs      -> TizenTVFlyoutView
  FlyoutViewExtensions.cs  -> TizenFlyoutViewExtensions + TizenFlyoutBehaviorExtensions
  ToolbarExtensions.cs     -> instance methods on TizenToolbarView

plus the protected override surface on TizenStackNavigationManager that Wave C
derives from: OnNavigationFinished, CreateNavigationItem, OnPageRemoved, the
existing InitializeStack, and a protected Toolbar accessor. Navigation now routes
page creation and removal through those seams so a handler can decorate pages or
observe completion without forking RequestNavigation.

Two naming decisions worth recording, both to avoid ambiguity rather than
collision:

 - ToolbarExtensions.UpdateTitle/UpdateMenuButton became INSTANCE methods on
   TizenToolbarView. They only ever applied to that one type, and as extensions
   they would have been ambiguous at any call site that also imported MAUI's
   Microsoft.Maui.Platform.

 - FlyoutViewExtensions.ToPlatform(this FlyoutBehavior) became
   ToTizenDrawerBehavior. MAUI defines a large family of ToPlatform extensions,
   and an identically named one on an enum is an ambiguity hazard wherever both
   namespaces are in scope. An IFlyoutView overload is provided alongside it.

OnPageRemoved keeps the handler disposal in its base implementation, with a note
that an override which does not call base will leak the popped page's whole child
handler graph - popping only unparents the native view.

The flyout extensions stay in the platform-only compile lane even though the
behaviour mapping is pure enum logic, because DrawerBehavior is a TizenFX type;
that is recorded next to the compile item rather than left to be rediscovered.

Everything here derives from or returns real NUI types, so it is type-checked by
the reference-pack lane and pinned by source tests rather than instantiated: the
tests assert the types exist under the agreed names, are wired into the compile
lanes, appear in the PublicAPI baseline, expose the exact Wave-C-facing members,
that both drawers forward the toolbar to their content, and that the superseded
imported files stay uncompiled.

265 tests pass, the analyzer reports zero diagnostics (388 product API entries),
and eng/build-workload-free.sh is green end to end.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
My previous commit merged the foundation branch and hit a content conflict in
eng/build-workload-free.sh. The 'git add -A' in the same command staged the
conflicted file, so a literal <<<<<<< marker was committed and pushed - the
script would have failed to parse on the very next CI run.

Both sides were purely additive, so the resolution keeps all four projects: my
two backend verification lanes and the foundation's two new probes.

Verified with 'bash -n' and a full green run of the script.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Redth
Redth changed the base branch from redth-tizen-foundation-import to main August 27, 2026 00:09
Redth pushed a commit that referenced this pull request Aug 27, 2026
Trial-merged Core PR #5 head 4e256f1 locally, compiled Wave C against it with
the API15 acceptance gate on, then discarded the merge. Core is COMPLETE for
Wave C - every type and extension Wave C needs is present, including the
FlyoutBehavior mapping, which Core named ToTizenDrawerBehavior rather than
ToPlatform. After the four renames all remaining diagnostics were Wave C's own
section C/D cleanup.

The trial also surfaced a Core <-> Wave B duplicate-surface collision that is
not Wave C's: TizenPlatformExtensions and TizenWaveBViewExtensions both declare
ToPlatformVisibility, UpdateFlowDirection and UpdateVisibility in the same
namespace, so every consumer gets CS0121. That will break the Core -> Wave A ->
Wave B rebase independently of Wave C; reported to the coordinator.

Independent review rejected the decomposed three-member #37862 proposal, so the
expiry detector explicitly stays broad enough to catch both that shape and the
expected single nullable resolver. No name is treated as final.

Nothing rebased, nothing adopted; PR #13 remains draft.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Redth and others added 3 commits August 26, 2026 20:28
Independent code and architecture reviews on 4e256f1 found four defects.
All four are fixed here, and each fix is mutation-tested: the guard was
run against the unmodified bug and confirmed to fail.

Product fixes:

- InvalidateMeasure only re-laid-out views that were themselves a
  ViewGroup. Leaf natives are not: TizenLabelView is a TextLabel with a
  null Layout, so invalidating a label did nothing and stale text
  measurements survived. Restored the parent-propagation branch.

- MakeApplicationScope mutated the context it was called on instead of
  returning a new one, so every caller sharing that context silently
  acquired the application scope. Now returns a new TizenMauiContext,
  matching MakeWindowScope.

Test fixes, both of which were passing against broken product code:

- The background-transition tests asserted only that the mapper ran, so
  they could not observe whether a null Paint actually cleared the prior
  native colour - the behaviour they exist to protect. Added an
  Applied(handler, key, detail) instrumentation overload that records
  clearWhenNull, and asserted the ordinary-view/page-view split.

- The primitive compile-lane test matched the file name anywhere in
  Sources.props, and the supersession comment block names every file it
  documents. Deleting a real compile item left the comment behind and
  the test still passed. Now matches Include= attributes only.

Architecture findings:

- RefPackCompile defined PLATFORM; the product does not. A future
  #if PLATFORM block would compile in the verification lane and vanish
  from the shipping assembly - the exact drift this lane exists to
  catch. Removed, and pinned by a test.

- Sources are listed explicitly rather than globbed, so a new file can
  be compiled by no lane at all while everything stays green.
  SourceLaneCoverageTests closes that gap, using the declared namespace
  as the ownership signal: the repository holds raw unported dotnet/maui
  sources, some Tizen-prefixed but neutrally namespaced, which must stay
  out of the lanes.

- That test began as "no neutral namespace may be compiled", which is a
  proxy for CS0433 rather than CS0433, and it failed on correct code:
  TizenLifecycle deliberately declares Microsoft.Maui.LifecycleEvents so
  AddTizen resolves without an extra using, as the in-repo backend did.
  Sharing a namespace is fine; sharing a fully qualified type name is
  not. Replaced with a direct check of every declared type name against
  the types the referenced MAUI assemblies actually export, so it stays
  correct if MAUI ever reintroduces a Tizen type.

- docs claimed both lanes compile "the same sources". They are
  complementary - the platform sources need real TizenFX and cannot
  build in the host lane. Documented the actual split.

Validation: 270 host tests (up from 265), Debug and Release; ref-pack
lane builds against real TizenFX with the PublicAPI analyzer enabled and
no RS0016/RS0017; full workload-free gate passes. Merged origin/main.
Nothing has been run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
An MSBuild review found two merge blockers. Both were reproduced before
being fixed, and the fixes are mutation-tested.

1. The real sample compiled nothing.

   TizenPackage.props defaults EnableDefaultCompileItems to false, since
   most projects here still hold raw imported sources that do not build
   yet. The sample never opted back in, so it evaluated Compile=[] - an
   application head that built successfully while containing no code,
   produced no entry point, and demonstrated nothing. Confirmed with
   `dotnet msbuild -getItem:Compile`, which returned an empty array.

   Its four sources were instead compiled inside the backend ref-pack
   lane. That type-checked them but merged them into one Core+sample
   assembly, so the package boundary the sample exists to demonstrate
   was never crossed: a sample reaching for a backend internal, or for
   anything invisible across an assembly reference, compiled clean.

   The sample now globs its own sources, as a real Tizen app head does,
   and a new tests/Maui.Tizen.Sample.RefPackCompile compiles it as its
   own assembly with a ProjectReference to the backend lane - which now
   carries the real product AssemblyName, so the reference reproduces
   what a package consumer sees rather than a lane-shaped substitute.

2. PublicAPI ownership was false-green.

   With one merged compilation and both baseline pairs attached, either
   baseline satisfied either assembly. Moving
   Microsoft.Maui.Platforms.Tizen.TizenFlyoutView out of the backend
   baseline and into the SAMPLE's still built successfully - verified.
   Each lane now sees only its own baseline; that same mutation fails
   RS0016, and dropping a sample entry fails RS0016 in the sample lane,
   confirming the analyzer is genuinely live in both.

Validation-gap fixes requested with the blockers:

- The ref-pack-only PLATFORM define was already removed in 8b06927; it
  is now pinned by an evaluated-property assertion rather than csproj
  text.

- Guards that grepped Sources.props are converted to EVALUATED MSBuild
  items via a shared MSBuildEvaluation helper. Text matching answered a
  different question than the one asked: the props file carries a
  supersession comment naming every file it documents, so deleting a
  real Compile item left the comment behind. Evaluation also follows
  imports, conditions and item removals, which text cannot.

- ProjectEvaluationTests computed AdditionalFiles, assigned it to a
  discard, then asserted on raw csproj text - proving only that two
  strings appeared in the file. It now asserts what MSBuild evaluated.

TizenFX reference wiring moved to eng/targets/TizenRefPack.targets so
both lanes reference an identical TizenFX; the boundary between them
proves nothing otherwise.

Mutations confirmed caught: deleting a compile item; reverting the
sample to EnableDefaultCompileItems=false; re-absorbing the sample into
the backend lane; re-attaching the sample baseline to the backend lane;
moving a Core API into the sample baseline (fast guard and RS0016).

Validation: 280 host tests (was 270) Debug and Release; 42 foundation
tests; both ref-pack lanes build Release against real TizenFX with the
PublicAPI analyzer enabled and no RS0016/RS0017; full workload-free gate
passes and now covers the sample lane. The real sample still cannot be
built - it targets net11.0-tizen11.0 and is blocked on the Samsung
workload - and nothing has been run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Redth and others added 10 commits August 26, 2026 23:03
CI run 33028800722 was red on
DispatcherTests.ConcurrentDelayedDispatchesEachFireExactlyOnce, which
reported zero of its eight callbacks fired.

Classification first, since it was asked for: the timer guard in 8b06927
did not introduce this. The test dates from da6becf and has always armed
real timers for a few milliseconds and then pumped the loop for a fixed
600ms wall-clock window, asserting on whatever had arrived. That is a
race against the machine, not a test of the dispatcher. Nothing was
wrong with the dispatcher; the runner was too busy to deliver inside the
window. It reproduced locally under CPU load and could not be made
reliable by adjusting timeouts, which is why the fix is structural.

TizenDispatcher and TizenDispatcherTimer now take a TimeProvider
(internal - the host lane compiles these sources directly, so it does
not widen the package's public surface). Tests drive a ManualTimeProvider
whose clock only moves when they move it, so what is asserted is
ordering and multiplicity rather than whether a thread got scheduled.

Doing that surfaced a genuine bug the wall-clock tests could not see. A
one-shot timer whose Tick handler calls Start() to re-arm - the standard
shape for a self-scheduling loop with a variable delay, which MAUI's own
animation code uses - fired exactly once and then stopped dead. Start()
is a no-op while IsRunning is true, and IsRunning was still true during
the handler. A one-shot has already fired by the time its handler runs,
so IsRunning is now cleared first. A test proves three chained restarts.

Also from the review:

- Dispose marks itself disposed before tearing the timer down, so a tick
  already queued on the main loop declines to run rather than raising
  Tick on a disposed timer. Stop and Dispose are both re-checked after
  the handler returns, since handlers routinely call them.

- A non-repeating timer is armed with an infinite PERIOD instead of
  being armed to repeat and disarmed after the first tick, which closes
  the window where the underlying timer could queue a second tick before
  the disarm landed.

- DelayedDispatch takes an Interlocked exactly-once, so a duplicate is
  impossible even if the timer double-fires.

Honesty about what the tests actually prove, because mutation testing
said otherwise on the first attempt. Of six guards, mutating four of
them still passed. Two were genuinely redundant once IsRunning is
cleared early, and a generation counter added for re-arm detection was
one of them - it is removed rather than kept as complexity no test can
justify. The remaining _disposed check on entry is redundant with
IsRunning on a single thread and is documented as concurrency-only
defence rather than claimed as covered. The exactly-once guard was
unfalsifiable until ManualTimeProvider grew a DoubleFireTimers fault
injection that reproduces the upstream race on demand; mutating it now
fails. A comment claiming Timer.Change throws ObjectDisposedException
after disposal was removed - on .NET 11 it returns false, verified.

Separately, Wave A raised that MAUI's mappers might be instantiated as
PropertyMapper<IView, ConcreteHandler>, so an inherited chained key
would hard-cast a Tizen handler. Reflecting over the live package says
otherwise: LabelHandler, ViewHandler, ContentViewHandler, LayoutHandler
and WindowHandler all instantiate with the INTERFACE argument, before
and after RemapForControls. But a delegate body can cast regardless of
how its mapper is typed, so MapperCastSafetyTests now invokes every
reachable key against a Tizen handler through a real Controls host and
fails only on InvalidCastException - empirical, and it stays honest
across package upgrades. Injecting a casting entry fails it.

The evaluation-based build guards are batched into one MSBuild
invocation per project; per-question spawning had taken the suite from
3s to 5m35s.

Validation: 296 host tests (was 280), both ref-pack lanes build against
real TizenFX with the PublicAPI analyzer clean. Nothing run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
…olation

Continues the review list on top of e463a62.

Lifecycle. A cold start is now Created then Activated, with NO Resumed.
Resumed means "came back from being stopped" - that is how MAUI defines
it and what Android does, raising it from OnRestart rather than the
first OnStart. Tizen delivers OnResume for both a cold start and a
return to the foreground and gives no hint which, so the bridge has to
remember. Raising it unconditionally made every launch look like a
return from the background, so an app restoring state in Resumed did it
on first run too. Duplicate Stopped and Resumed are suppressed, since
Tizen can deliver OnPause twice with no OnResume in between and a
duplicate is observable to anything that pairs them.

TextDecorations is a [Flags] enum but was matched with a switch over the
whole value, so Underline|Strikethrough matched neither arm and fell
through to None - removing BOTH decorations in the case where the user
asked for the most. Verified against the shipped assembly's metadata
that the native enum really is bitwise (Underline 1, Strikethrough 2).

Clearing MinimumWidth/MinimumHeight returned early instead of resetting
the native constraint, so a view whose minimum was set once could never
shrink below it again.

Both of those decisions moved into TizenPropertyResolvers, an internal
portable type, so they execute in the host lane. Everything in
TizenPlatformExtensions needs a real native view and can only ever be
compile-checked; these bugs lived in the small amount of logic in front
of the native assignment, which is exactly the part that can be tested.
Made internal rather than public after the PublicAPI analyzer correctly
objected to widening the package surface for testability.

ITizenToolbarContainer.SetToolbar is a push with ownership transfer: it
disposes the toolbar it replaces. Passing the toolbar that is already
attached now short-circuits instead of disposing and re-adding the same
instance, which left a disposed native view in the tree and failed later
somewhere unrelated. The ownership contract, and the requirement to
unsubscribe before replacing, are documented on the interface for the
Wave C consumers.

Symbol parity now compares the evaluated product against the evaluated
ref-pack lane in both directions. It previously asserted the lane's
constants equalled a hard-coded { "TIZEN" }, so it could not see a
symbol the PRODUCT gained and the lane did not - drift the other way,
and just as damaging - and it read the csproj into a discarded variable.
The same check now covers the sample and its lane.

Test isolation. The new cast-safety tests force Controls' RemapForControls,
which mutates MAUI's process-wide static mappers, and xUnit runs
collections in parallel. That made
BackgroundTransitionTests.OrdinaryViewStillClearsAfterTransitionToNull
fail roughly one run in three while passing in isolation - a test whose
own code never changed - because the mapper's key lookup is not safe
against concurrent mutation. Every class touching those statics now
shares a non-parallel collection. Four consecutive Release runs are
clean; before the fix, one in three was red.

Already closed, verified rather than redone: InvalidateMeasure calls
SetNeedMeasureUpdate on TizenLayoutViewGroup and TizenContentViewGroup
and matches upstream's implementation line for line.

Validation: 307 host tests, Debug and Release; both ref-pack lanes build
against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate passes. Every fix above was mutation-tested. Nothing
has been run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
…ical-slice

# Conflicts:
#	Maui.Tizen.slnx
#	eng/build-workload-free.sh
The review asked Core to implement real Tizen mappings for
AutomationProperties.IsInAccessibleTree and ExcludedWithChildren, on the
grounds that key presence alone is false-green. The key presence part is
right - those keys resolve to no-ops today - but Core cannot close it,
and it is worth being precise about why.

Both keys are contributed by Controls' RemapForControls, and the action
behind them lives in Controls' per-platform code, Element.Tizen.cs, not
in Core. A backend package supplying it would have to reference Controls
and invert the dependency direction.

Upstream, both of those methods are empty `//TODO : Need to impl` stubs.
These annotations have therefore never worked on Tizen at all, and the
stub disappears with dotnet/maui's Tizen target.

What Core can legitimately own is the native half, so this adds
UpdateIsInAccessibleTree and UpdateExcludedWithChildren over NUI's
AccessibilityHighlightable and AccessibilityHidden. Both flags are
written rather than just the one, so re-enabling genuinely restores an
element instead of leaving it hidden; AccessibilityHidden already
applies to the subtree, which is exactly ExcludedWithChildren's meaning.
Recorded as gap G10 with an owner needed.

PublicAPI entries were generated with `dotnet format analyzers
--diagnostics RS0016`, after a hand-edit produced malformed entries and
reordered the file. Baselines here are generated, never hand-written.

Validation: 307 host tests, both ref-pack lanes clean including the
PublicAPI analyzer. The new methods are compile-checked against real
TizenFX and, like all NUI-touching code here, have not run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Navigation reconciliation assumed the new stack was the old one with
pages added or removed at the top. Two consequences, both real:

- Pushing started at the old stack's Count, so replacing pages - [A, B]
  becoming [A, C, D] - pushed C and D on top of B and left B in the
  platform stack. The managed and native stacks then disagreed
  permanently, and nothing threw to say so.

- The insert path indexed the OLD stack with a position taken from the
  LONGER new one, so inserting more than one page beneath an unchanged
  top raised ArgumentOutOfRangeException.

- Insertions and removals were mutually exclusive branches chosen by
  comparing stack COUNTS, so a change that both added and removed pages
  did only half the work and orphaned a page.

Replaced with longest-common-prefix reconciliation: pop everything above
the prefix, push the new remainder. That covers replacement, insertion,
truncation and wholesale rebuild without special cases. Only the last
visible transition animates - animating the intermediate pops would show
the user pages they never navigated to.

The decision is in TizenNavigationReconciler, an internal portable type,
so it executes in the host lane. The manager derives from a NUI view and
can only ever be compile-checked, and the bugs were all in the decision
rather than in the native calls.

Separately, OnPageRemoved dropped the TizenNaviPage wrapper from its map
but never disposed it, so every page leaving the stack leaked one. It
now clears Content BEFORE disposing the wrapper: the content is the
handler's platform view, which the handler disposes, and disposing the
wrapper while it still held that content would dispose the child twice.

Ten tests cover replacement, wholesale rebuild, push-only, pop-to-root,
identical stacks, emptying, multi-page insertion, simultaneous
insert+remove, and reference rather than value identity for repeated
page instances.

Mutation testing caught a weak test here. The insert+remove case used
equal-length stacks, which cannot trigger a length-comparison branch, so
restoring that bug still passed. Added a case where the target is longer
AND a page is dropped; it now fails.

Validation: 317 host tests, both ref-pack lanes clean with the PublicAPI
analyzer, full workload-free gate passes with zero failures. Nothing has
been run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Core computed Window.Default.Dpi.X / 160 while the NUI controls, gesture
recognisers and swipe thresholds all use
Tizen.UIExtensions.Common.DeviceInfo.ScalingFactor. Verified against
Samsung's source, that formula was wrong in three separate ways:

- UIExtensions reads Dpi.Y, not Dpi.X.

- On TV and IoT it does not read the panel at all - it returns a
  hard-coded 213. Reading the reported DPI there put the backend on a
  completely different scale from every native control on the same
  screen, which is the worst of the three because it is invisible on a
  phone and total on a television.

- DPI / 160 is only correct for the DP unit. Of DeviceInfo's five
  display resolution units, Core implemented none of the other four.
  DeviceScaledDP is not even exclusive of DP - it takes DPI / 160 AND
  the large-display multiplier - so the obvious reading gets it wrong.

There was also a distinction Core had collapsed. Upstream MAUI's Tizen
backend keeps ToPixel (physical, DPI / 160) separate from ToScaledPixel
(the scaling factor); they coincide only in DP mode. Core used the
physical formula for both, so every scaled conversion silently ignored
the display unit. ToPixel and PhysicalScale now exist alongside the
scaled forms.

At runtime the backend now delegates to DeviceInfo.ScalingFactor, so
there is exactly one source of truth on a device and no way for the two
to drift. TizenScalingPolicy expresses the same algorithm over
injectable metrics: it drives the host tests, documents the policy for
Wave B and alerts to consume, and answers before a NUI window exists.
DisplayResolutionUnit and ViewPortWidth are forwarded to DeviceInfo so a
host cannot move one side without the other.

The type's own documentation claimed this backend "deliberately does not
take a package dependency on" DeviceInfo. That was false - the package
has always carried a PackageReference to Tizen.UIExtensions.NUI and uses
its types throughout. Corrected.

Nineteen tests cover the TV/IoT substitution, all five resolution units,
the VP zero-viewport guard, both large-display thresholds, and that
those thresholds are measured in DP rather than pixels - a high-density
handset has plenty of pixels and few DP, and comparing pixels would
quadruple everything on an ordinary phone. All five mutations fail,
including two that restore Core's previous behaviour exactly.

Also adds SharedExtensionOwnershipTests, which pins the exact
UpdateVisibility, UpdateFlowDirection and ToPlatformVisibility
signatures Core publishes and asserts each is declared once. Duplicate
extension methods only produce CS0121 when both namespaces are imported
into the same file; otherwise whichever is in scope wins and the copies
drift apart silently - exactly how the scaling divergence arose. Wave B
can delete its copies against a machine-checked signature rather than on
trust.

Test isolation, for the second time: ScalingPolicyTests and
DisplayDensityTests both mutate the process-wide density override, and
xUnit runs collections in parallel, so DisplayDensityTests began failing
intermittently. Both now share a non-parallel collection. Four
consecutive Release runs are clean.

Validation: 336 host tests, Debug and Release; both ref-pack lanes build
against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate passes with zero failures. PublicAPI entries
generated with dotnet format analyzers. Nothing has run on a device -
the delegation to DeviceInfo is compile-checked only.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Closes the four blockers from the 2f19d review. Two were real bugs, one
of them mine. The other two turn out not to be Core's to close, with
evidence.

1. Leaf invalidation. The leaf branch called MarkChanged on the parent
   even when that parent WAS a TizenLayoutViewGroup or
   TizenContentViewGroup. Those cache an intrinsic size behind a
   _needMeasureUpdate flag, so marking them merely "changed" re-laid-out
   the children at the size already computed - a label whose text grew
   repainted clipped and the stack never reflowed. InvalidateMeasure now
   walks up to the nearest measure-caching ancestor and calls
   SetNeedMeasureUpdate, which marks changed and requests layout, and
   falls back to the nearest plain group only when there is none.

2. Navigation disposal ownership, and this one I introduced in 2f19d87.
   TizenNaviPage's Content setter DISPOSES what it replaces, so clearing
   Content to detach disposed the handler's platform view - which the
   handler then disposed again. A double dispose that throws nowhere near
   the mistake, if at all.

   Ownership is now stated and enforced: the handler owns the page
   content, the wrapper owns its title view and itself. DetachContent()
   unparents without disposing and is what removal uses.

   GetNavigationItem also created on miss, so asking for a page that had
   already been released silently rebuilt a wrapper by calling
   ToPlatformView on a view whose handler was disposed. Released pages
   are now tracked and that throws with a message that says what to do.

3. Label FormattedText / LineBreakMode / MaxLines. ILabel carries only
   TextDecorations and LineHeight - verified by reflection over the
   shipped Microsoft.Maui assembly - so all three live on Controls' Label
   and this package cannot read them without referencing Controls and
   inverting the dependency direction. Upstream binds LineBreakMode from
   Controls' own Label.Tizen.cs, and its MapMaxLines is an empty
   [MissingMapper].

   Core ships the half it can own: UpdateLineBreakMode, with a real
   conversion table. That matters more than it looks - the two
   LineBreakMode enums are NOT ordinal-compatible. Microsoft.Maui's
   NoWrap is 0 and the native NoWrap is 1, so casting turns NoWrap into
   None and shifts every value after it. Both sets were read from the
   shipped assemblies' metadata; a first version of the table written
   from a plausible guess was wrong.

   MaxLines deliberately has no primitive. There is no native equivalent:
   TextLabel exposes LineCount (read-only), MultiLine and Ellipsis, none
   of which caps rendered lines, and UIExtensions' Label exposes only
   LineBreakMode. That is almost certainly why upstream's mapper is
   empty. A resolver would be dead code dressed up as coverage.

4. Accessibility key wiring. Same shape, same conclusion, unchanged from
   26c7ef9: the keys are Controls-contributed and their action lives in
   Controls' Element.Tizen.cs, where upstream leaves both as
   `//TODO : Need to impl`. Core ships the native halves. Recorded with
   the Label findings as gap G10.

Validation: 351 host tests, Debug and Release; both ref-pack lanes build
against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate passes with zero failures. The line-break mapping is
mutation-tested, including a mutation that casts between the enums.
Nothing has run on a device - the leaf-remeasure walk and the disposal
ordering are compile-checked only.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
All seven verified against source before fixing. Two were bugs I
introduced, and two turned out to be upstream bugs faithfully ported.

1. TizenContentViewGroup.SetNeedMeasureUpdate marked dirty without
   scheduling a layout pass. UIExtensions' MarkChanged is literally
   `_markChanged = true`, and the flag is only read inside
   SendLayoutUpdated, which NUI calls from OnLayout - so with nothing
   requesting a pass the dirty flag waits for an unrelated one to come
   along. TizenLayoutViewGroup requests it; this type did not, which is
   upstream's shape and wrong in both places. It also made the comment
   on my own leaf-remeasure fix false, since that fix relies on
   SetNeedMeasureUpdate scheduling layout.

2. Animated pop double-disposed the wrapper, and this was mine. The two
   NavigationStack overloads have different ownership, which their names
   do not suggest: Pop(bool) ends with `tobeRemoved.Dispose()`, Pop(View)
   only unparents. Treating them alike disposed the wrapper twice and
   detached content from an already-disposed object. Content is now
   detached before either call, and the animated path hands ownership
   over by removing the wrapper from the map before awaiting.

3. Refusing to re-push a popped page, also mine. MAUI allows popping and
   re-pushing the same instance, and applications do it routinely. Worse,
   the refusal threw from RequestNavigation, which is async void - so an
   ordinary re-push became an unhandled exception on the main loop.
   Released pages now clear their disposed handler instead, so the next
   push builds a fresh one.

4 and 5. Controls properties are now BOUND rather than resolved into
   nothing. ILabel exposes only TextDecorations and LineHeight, so
   LineBreakMode and the accessibility annotations live on Controls types
   that Core must not reference. The binding therefore goes in
   Maui.Tizen.Controls - a real product assembly that already references
   Controls and Core - and is compiled by a new
   Maui.Tizen.Controls.RefPackCompile lane against real TizenFX. It is a
   separate assembly on purpose: folding it into the Core lane would
   merge a Controls-referencing assembly into one that must never
   reference Controls, hiding the exact mistake this layer avoids.

   Both accessibility keys route to ONE mapper action reading both
   properties, because they resolve onto the same two NUI flags and
   separate helpers let the later key silently undo the earlier. The two
   single-property helpers are replaced by UpdateAccessibility.

   MaxLines and FormattedText are deliberately NOT registered - no inert
   keys. MaxLines has no native equivalent; FormattedText needs a
   FormattedString-to-markup conversion that upstream also lacks on
   Tizen. Recorded as an explicit Wave A requirement rather than claimed.

6. Strikethrough never reached the native label. UIExtensions' Label
   TextDecorations setter reads ONLY the Underline flag - it stores the
   value and applies an underline PropertyMap, dropping Strikethrough
   without a word. So the earlier flags fix computed the right value and
   handed it to a sink that ignores it. Applied via API15's
   TextLabel.SetStrikethrough.

7. A page could never lose a background once given one. Its two "no
   background" states are different and only telling them apart over time
   gets both right: never set keeps the opaque white it was created with,
   while set-then-cleared must go back to white - not transparent, since
   white is the page default. Tracked per handler in a weak table rather
   than an instance field, so it works for any IPageHandler including
   subclasses and test doubles.

Every fix is mutation-tested. One near-miss worth recording: an
index-based edit silently deleted 129 lines of Label extensions, caught
by the build rather than by review, and redone with line-anchored edits.

Validation: 358 host tests, Debug and Release; all three ref-pack lanes
build against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate zero failures. Nothing has run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
CI failed on DispatchDelayedFiresExactlyOnceEvenWhenTheLoopIsSlow with
zero callbacks delivered where it asserted one. The test slept 900ms and
hoped, while its own comment claimed it was deterministic - one I missed
when converting the rest of the dispatcher tests to a driven clock.

It now uses ManualTimeProvider with DoubleFireTimers, so the race is
reproduced on every run rather than depending on how busy the machine
is. The slow Post is kept, because that interleaving is the point: the
callback is still inside Post when the timer would come round again.

Removing the exactly-once guard still fails it, so the coverage is
unchanged - only the dependence on wall-clock timing is gone.

Validation: 358 host tests, Debug and Release; full workload-free gate
zero failures across all three ref-pack lanes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Wave A integration decision, plus the image-background gap.

NoParallelTizenHandlerInterfacesRemain now scopes to actual handler
contracts - interfaces deriving from IElementHandler - instead of
asserting an exact list of every exported ITizen* type. The wider form
failed for any downstream wave adding an unrelated ITizen* SERVICE
interface, which is a real cost for no benefit: a service interface
cannot be a parallel handler hierarchy, which is the only thing that
test exists to prevent.

Added NoTizenPrefixedInterfaceShadowsAMauiHandlerInterface for the
substance behind the name: a parallel hierarchy shows up as a
Tizen-prefixed interface shadowing one MAUI already ships
(ITizenLabelHandler beside ILabelHandler), which is what forced handlers
to choose and blocked Controls mapper composition.

The exported inventory moves to TizenPublicInterfaceInventoryTests,
named for what it does. Writing it surfaced two things worth recording:

- The inventory is four interfaces, not the three I expected -
  ITizenLifecycleBuilder was missing from my list. Exactly the drift a
  change-detector should catch, caught on its first run.

- It reads the PublicAPI baseline rather than reflecting over the test
  assembly. Reflection cannot answer this: the host lane compiles only
  portable and handler sources, so interfaces declared beside
  TizenFX-dependent code are absent from it, and reflecting would report
  a smaller set than the package publishes - under-pinning the surface,
  the opposite of the point.

Mutation-tested both directions: reintroducing a parallel
ITizenLabelHandler fails both tests, while adding an unrelated
ITizenClipboardService leaves parity passing.

Image backgrounds. ImagePaint.ToColor() returns null, verified against
Microsoft.Maui.Graphics, so an image background produced no colour and
the mapper did nothing - leaving whatever was painted before. Setting an
image background appeared to have no effect while a stale colour stayed
on screen. It now clears: the image is unrendered either way, but the
view ends up in a defined state rather than an arbitrary one. Gradients
keep collapsing to their representative colour, and a test pins that the
two paint kinds take different paths.

Rendering image backgrounds properly needs IImageSourcePaint, which
reflection shows is INTERNAL in Microsoft.Maui 11.0.0-preview.7.26426.4,
plus a container view to draw into. Recorded as gap G11 - and noting it
contradicts guidance that the type is now public, which may hold on a
later build than this package pins.

Validation: 364 host tests, Debug and Release; full workload-free gate
zero failures across all three ref-pack lanes. Nothing run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
kubaflo pushed a commit to dotnet/maui that referenced this pull request Aug 27, 2026
…nage ContainerView (#37854)

<!-- 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 of Change

`ViewHandler.SetupContainer()` and `ViewHandler.RemoveContainer()` are
`protected` extensibility points, but `ViewHandler.ContainerView`'s
setter is `private protected`. A handler that derives from
`ViewHandler<TVirtualView, TPlatformView>` **in another assembly** — for
example a platform backend that ships outside of `dotnet/maui` — can
therefore override `SetupContainer()`, create a wrapper, and re-parent
the platform view into it, but has no way to publish that wrapper as the
handler's container view.

The practical consequence (reported from
[Redth/Maui.Tizen#5](Redth/Maui.Tizen#5), gap
**G1**) is that an external backend has to report `NeedsContainer =>
false` and permanently loses gradient/image backgrounds, `Clip`, and
`Shadow`, since all of those are rendered by the container view on every
in-box platform.

### The API

A single additive `protected` method on `ViewHandler`:

```csharp
protected void SetContainerView(PlatformView? containerView);
```

- Passing a view **installs** it as `ContainerView`; passing `null`
**clears** it.
- `ContainerView`'s getter is already `public`, so **access** was never
the gap.
- The method **only records** the container view. It never re-parents
anything and it does not change `HasContainer`, so
`SetupContainer()`/`RemoveContainer()` remain solely responsible for the
view tree and .NET MAUI remains solely responsible for invoking them
when `HasContainer` flips.

I deliberately did **not** widen `ContainerView`'s setter to
`protected`. A method is the narrower contract: it cannot be assigned
through a base-typed reference by accident, it gives a single choke
point for validation, and it keeps the "the setter is an implementation
detail" invariant intact for the built-in handlers.

### Preserving platform type safety

On iOS/MacCatalyst and Tizen, `ViewHandler<TVirtualView, TPlatformView>`
shadows `ContainerView` with a `WrapperView`-typed property whose getter
**hard-casts** the base value:

```csharp
public new WrapperView? ContainerView
{
    get => (WrapperView?)base.ContainerView;   // InvalidCastException if the base holds a plain UIView
    protected set => base.ContainerView = value;
}
```

Any write access to the base value can violate that invariant. So
`SetContainerView` routes through a new `private protected virtual void
ValidateContainerView(PlatformView)` hook, which iOS/MacCatalyst and
Tizen override to reject non-`WrapperView` containers with a clear
`ArgumentException` at the point of the mistake, rather than an
`InvalidCastException` later from an unrelated getter. Android and
Windows use `is WrapperView` pattern matching for their container
access, so they accept any platform container type and need no guard.

### What is *not* changed

- No built-in handler was modified. `ButtonHandler`,
`ImageButtonHandler`, `ImageHandler`, `LabelHandler`, `BorderHandler`,
`ShapeViewHandler` and the per-platform `ViewHandler<,>` partials all
keep using the existing `private protected` setter, so setup/remove
flow, `PlatformView`/`ContainerView` propagation, disposal, and hot
reload behavior are byte-for-byte unchanged.
- `IViewHandler.ContainerView`, `HasContainer`, `NeedsContainer`, and
`MapContainerView` are untouched.
- No existing public API was changed or removed. The additions are
recorded in `PublicAPI.Unshipped.txt` for all eight API surfaces.

## Tests

Existing test assemblies (`Microsoft.Maui.UnitTests`,
`Microsoft.Maui.Core.DeviceTests`, …) are `InternalsVisibleTo` friends
of `Microsoft.Maui`, and a friend assembly *can* reach `private
protected` members from a derived type. A test written there would
therefore have proved nothing about external reachability.

So this PR adds
**`src/Core/tests/ExternalBackend/Core.ExternalBackend.csproj`** →
`Microsoft.Maui.Core.ExternalBackend.TestSupport`, which is
**deliberately not listed** in
`src/Core/src/Properties/AssemblyInfo.cs`. It contains an
`ExternalBackendViewHandler<TVirtualView, TPlatformView>` modelled on
the real Tizen handler, written against nothing but public/protected
API. **The fact that this assembly compiles is the proof** that the new
API is reachable from a non-friend assembly. (This mirrors the existing
`Controls.Xaml.UnitTests.ExternalAssembly` pattern.)

`ExternalBackendContainerViewTests` (10 tests in
`Microsoft.Maui.UnitTests`) then covers:

| Test | What it locks down |
| --- | --- |
| `ExternalBackendAssemblyIsNotAFriendOfMauiCore` | Asserts the support
assembly is not in `Microsoft.Maui`'s `InternalsVisibleTo` list, so the
compile-time proof cannot silently rot |
| `SetupContainerInstallsContainerViewAndReparentsPlatformView` |
Container installed, platform view re-parented, container takes the
**exact sibling index** the platform view occupied |
| `ContainerViewIsVisibleThroughIViewHandler` |
`IViewHandler.ContainerView` reflects the externally installed container
|
| `RemoveContainerRestoresPlatformViewAndClearsContainerView` | Platform
view restored to its original parent/slot, container cleared and
disposed |
| `NeedsContainerTransitionsDriveSetupAndRemoval` | Full
`NeedsContainer` → `MapContainerView` → `HasContainer` →
`SetupContainer`/`RemoveContainer` chain, including that an
already-present container is not set up twice |
| `SetupAndRemoveCanRoundTripRepeatedly` | Three full install/remove
cycles leave the view tree exactly as it started |
| `SettingHasContainerToTheSameValueIsANoOp` | No redundant setup/remove
|
| `SetContainerViewInstallsAndClearsTheContainerDirectly` | Raw
install/clear semantics, and that `SetContainerView` does **not** flip
`HasContainer` |
| `DisconnectingTheHandlerAfterContainerRemovalIsClean` |
Disposal/lifecycle: wrapper disposed, `PlatformView` nulled, virtual
view's handler detached |
| `FullViewMapperStillDrivesTheExternalContainer` | The real
`ViewHandler.ViewMapper` chain (not just an isolated mapper) drives the
external container |

### Verification run locally

- `Microsoft.Maui.Core.ExternalBackend.TestSupport` builds ✅ (the
external-access proof)
- `Core.UnitTests` — **961 tests, 958 passed, 3 skipped, 0 failed** ✅
- `Controls.Core.UnitTests` — **6237 tests, 6207 passed, 30 skipped, 0
failed** ✅
- PublicAPI analyzer in `Validate` mode ✅ (verified negatively too:
reverting `SetContainerView` to `private protected` makes it fail with
`RS0017`)
- `dotnet format whitespace --verify-no-changes` reports no findings in
any touched file ✅
- iOS/MacCatalyst/Android/Windows/Tizen TFMs could not be built locally
(workloads unavailable in this environment) — relying on CI for those.

## Adoption for an external backend (e.g. Maui.Tizen)

```csharp
public class TizenViewHandler<TVirtualView, TPlatformView> : ViewHandler<TVirtualView, TPlatformView>
    where TVirtualView : class, IView
    where TPlatformView : NView
{
    public override bool NeedsContainer =>
        VirtualView?.Background is not null ||
        VirtualView?.Clip is not null ||
        VirtualView?.Shadow is not null ||
        base.NeedsContainer;

    protected override void SetupContainer()
    {
        if (PlatformView is null || ContainerView is not null)
            return;

        var wrapper = new TizenWrapperView();
        // …detach PlatformView from its parent, put it inside wrapper, attach wrapper in its place…

        SetContainerView(wrapper);
    }

    protected override void RemoveContainer()
    {
        // …detach the wrapper, put PlatformView back in its place, dispose the wrapper…

        SetContainerView(null);
    }
}
```

`NeedsContainer` no longer has to be pinned to `false`, so
gradient/image backgrounds, `Clip`, and `Shadow` become available to the
external backend.

## Issues Fixed

Addresses gap **G1** from
[Redth/Maui.Tizen#5](Redth/Maui.Tizen#5).

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Redth and others added 12 commits August 27, 2026 13:58
Merges PR #14's fail-closed workload gate. Clean merge, and the gate is
preserved intact - no continue-on-error reintroduced.

PR #14's transition regression test failed on the merged tree, and it was
right to. It discovers Tizen projects dynamically and requires each to be
listed in the real lane; eng/build-tizen.sh names six while this branch
now has seven. The sample became a real Tizen project when it started
importing TizenPackage.props and compiling its own sources, and
build-tizen.sh's own comment says the test "rejects a newly added Tizen
project that is not added here, including a future sample".

So the sample is added rather than the assertion relaxed. It is the only
project exercising the SingleProject/manifest path end to end, and an app
head that stops building is exactly what this lane exists to catch. It
sets IsPackable=false, so the pack phase no-ops for it rather than
failing. All 51 gate tests pass.

G11 corrected. My write-up said "IImageSourcePaint ... is INTERNAL,
verified by reflection". That conflated two types: I probed the concrete
ImageSourcePaint and wrote it up as though I had probed the interface.
Re-verified against the pinned package:

    IImageSourcePaint present : NO - absent from this package
    ImageSourcePaint present  : yes, public=False

The concrete class is intentionally internal and is expected to stay so.
What is missing is the public consumption-only IImageSourcePaint contract
from upstream PR #37864. That changes what we are waiting on - a new
contract, not a type being opened up - so the docs and the inline comment
now say that, and my closing note claiming this contradicted earlier
guidance is deleted, since that framing was mine and it was wrong.

No behaviour change from the correction: the mapper still clears on an
unrenderable paint and the adoption guard stays.

Validation: 364 host tests, Debug and Release; all three ref-pack lanes
build against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate zero failures; PR #14's gate suite 51/51. Nothing has
run on a device.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
All six verified against source before fixing. Two were bugs I introduced
in earlier "fixes"; two are upstream behaviour this backend was
inheriting.

1. Reentrant content invalidation. Both view groups suppress
   RequestLayout while a layout pass is running, so a measure invalidated
   DURING that pass scheduled nothing - and arranging children invalidates
   them constantly. The invalidation was simply dropped: the dirty flag
   stayed set with nothing to consume it. The outermost pass now replays
   it on the way out. The predicate is in TizenPropertyResolvers so it
   executes on the host; the groups derive from NUI types and can only be
   compile-checked, and the predicate is the part that was wrong.

2. Animated pop played the fade on an EMPTY wrapper. My previous fix
   detached content before Pop(true) to avoid a double dispose, which
   fixed the disposal and broke the animation - the page vanished
   instantly, then a blank rectangle animated out. The content now stays
   attached for the whole animation and is rescued afterwards, before the
   wrapper is disposed. One owner throughout: the handler owns the
   content, the wrapper owns itself.

3. TizenControlsMappings.Register had NO production caller. The bridge
   compiled, shipped and did nothing, while the unit tests that call it
   directly passed. ConfigureTizenControls now registers an
   IMauiInitializeService, and Register forces Controls' own lazy
   RemapForControls FIRST - registering before that runs is not merely
   useless, Controls' remap can replace the entries just installed, and
   the failure is silent and order-dependent.

   The bridge sources are now compiled into the host lane too, so the
   startup path is EXECUTED rather than only type-checked. That absence
   of execution is exactly why the missing caller went unnoticed.

4. Accessibility semantics. AccessibilityHidden removes an element AND
   its subtree; AccessibilityHighlightable governs only the element.
   IsInAccessibleTree is a statement about one element, so mapping it onto
   Hidden silently removed every descendant - a container marked
   not-in-tree took children with it that carry no annotation and are
   individually accessible on every other platform. Hidden is now reserved
   for ExcludedWithChildren. Unset annotations resolve to null and are not
   written at all, so an unannotated element keeps whatever the control or
   platform configured rather than being stamped with false.

5. Head and Middle truncation rendered as Tail. UIExtensions collapses all
   three modes into `MultiLine = false; Ellipsis = true;` and never sets
   EllipsisPosition, which defaults to End - so asking for a leading
   ellipsis produced a trailing one. Now set explicitly, with the native
   enum values read from API15 metadata rather than assumed.

6. Maui.Tizen.Controls had no PublicAPI analyzer and no baseline, so a
   shipping assembly's public surface could change silently. Both product
   and lane now reference the analyzer against a generated baseline.

   Its lane also referenced Microsoft.Maui.Controls - the XAML-inclusive
   package - while the product references Microsoft.Maui.Controls.Core. A
   lane with broader references than the product can compile code the
   product cannot, which is the one failure mode a verification lane must
   not have. Now matched, and a test pins it in both directions.

Mutation-tested: dropping the reschedule, rescheduling regardless of
depth, hiding the subtree from IsInAccessibleTree, stamping defaults over
unset annotations, collapsing truncation to End, removing the startup
registration, and restoring the XAML-inclusive reference all fail.

MaxLines and FormattedText remain explicitly assigned to Wave A.

Validation: 385 host tests, Debug and Release; all three ref-pack lanes
build against real TizenFX with the PublicAPI analyzer clean; full
workload-free gate zero failures; PR #14's gate suite 51/51.

Not verified: nothing has run on a device. The animated-pop ordering in
particular is compile-checked only - it is control flow around an await
on a native animation, which no host test can observe.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Wave A confirmed the handler-only predicate should keep expecting exactly
ITizenApplicationHandler and ITizenPlatformViewHandler, which it does, and
that the separate inventory must eventually carry ITizenFontManager and
ITizenModalHost.

Those types do not exist yet, so they cannot be added to an exact-match
list without failing it. What is recorded instead is the verification that
matters for the rebase: both are SERVICE interfaces, so neither derives
from IElementHandler nor shadows a MAUI handler interface. Confirmed by
temporarily declaring both and re-running the two guards, which pass - so
Wave A's rebase is a one-line change to the inventory and nothing else.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
The Blazor lane hit NonRepeatingTimerTicksExactlyOnce failing with
Expected 1 / Actual 0. It armed a 5ms timer, pumped the loop for a fixed
400ms and asserted exactly one tick; a loaded runner delivered none
inside that window. Nothing was wrong with the dispatcher.

Rather than convert only the reported test, I swept the file for others
of the same shape and found four, including one nobody has hit yet:

- NonRepeatingTimerTicksExactlyOnce (reported)
- RepeatingTimerKeepsTicking - asserted `ticks > 1` after a fixed 400ms
  window, so a busy runner observing 0 or 1 fails it. Unreported.
- TimerDoesNotTickBeforeStart
- StoppedTimerDoesNotRaiseQueuedTicks - slept 50ms hoping ticks had
  queued before Stop.

All four now drive ManualTimeProvider. That removes the timing dimension
rather than widening the window, and it strengthens the assertions as a
side effect:

- exactly-once is checked by advancing five MINUTES past the interval and
  confirming the count is still one, which a fixed window could only
  sample;
- the repeating timer asserts EXACTLY five ticks over five intervals
  rather than the inequality `> 1`, and that Stop really stops it;
- the stopped-timer case queues callbacks by advancing the clock, so
  "ticks were already queued" is a certainty rather than a hope.

Mutation testing needed a second pass, and the first pass was
misleading. Arming a one-shot with a repeating period did NOT fail
NonRepeatingTimerTicksExactlyOnce, and making the underlying timer fire
before Start did NOT fail TimerDoesNotTickBeforeStart - both looked like
weak tests. They are not: each behaviour is defended by two independent
layers, and breaking one leaves the other holding. Breaking BOTH fails
both tests, so the coverage is real. Recorded because the naive reading
of that first result would have been to weaken the code to make the
mutation "work".

Verified under load: five consecutive runs of the dispatcher suite with
16 busy cores, all green. The previous version failed on less.

Validation: 385 host tests, Debug and Release; full workload-free gate
zero failures. The Blazor project is Tizen-targeted and cannot be built
without the Samsung workload, so its lane is covered by the same
workload gate rather than by a separate run here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
MSBuild review found the Controls project declaring
Microsoft.CodeAnalysis.PublicApiAnalyzers when TizenPackage.props already
adds it to every project that imports it - two PackageReference items for
one package, NU1504 under CI product restore. Reproduced by evaluating
the project: 2 items, now 1. Core never had it.

The regression test asserts on EVALUATED PackageReference items, because
that is the only view that sees the import and the project together. My
existing TheAnalyzerIsReferenced test read csproj TEXT, which is why it
missed this: it both failed to notice a project correctly inheriting the
reference and stayed happy when a second was added on top. Converted, and
a companion test rejects ANY duplicate PackageReference, since the
analyzer was only the one that happened to be caught.

Merging live main exposed a second, related defect - a genuine failure
rather than churn.

Microsoft.Maui.Controls declares its own LayoutAlignment beside
Microsoft.Maui.Primitives.LayoutAlignment. Compiling the Controls bridge
into the host lane made the unqualified name ambiguous (CS0104) in every
stub implementing IView. Fixed with a global alias: the ambiguity is a
property of the assembly's reference set, not of any one test, and IView
is a Core interface so Primitives is always right.

Following the same error into the sample lane found the real problem. The
sample references ONLY Maui.Tizen.Core - it is a Core-only app head using
no Controls types - but its lane referenced Microsoft.Maui.Controls. That
extra reference produced a CS0104 in the sample's own stubs that the
product could never hit. This is the over-broad-lane defect already fixed
for Controls, in the other direction: red in the lane, fine in the
product. Both directions cost the lane its credibility, so the reference
is removed and a test now pins the sample lane too.

Solution conflict on Maui.Tizen.slnx resolved additively, keeping main's
validation file entries and this branch's props entries. All 8 Tizen
projects including the DevFlow agent are in the real lane - main's merge
already added it - verified by dynamic discovery rather than assumed.

Validation: 390 host tests, Debug and Release; all three ref-pack lanes
build Release against real TizenFX with the PublicAPI analyzer clean;
workload-free gate 117 PASS / 0 FAIL; workload transition suite 52/52;
solution parses. Duplicate-reference guard mutation-tested.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Each reproduced before fixing. B1 is the serious one.

1. The backend was unreachable from a real app. Core registers handlers
   against Core INTERFACES (ILabel, ILayout, IWindow), which is right for
   a Core-only head - but UseMauiApp registers MAUI's neutral handlers
   against Controls' CONCRETE types, and concrete beats interface in the
   handler lookup. Resolving through IMauiHandlersFactory returned
   LabelHandler, PageHandler, LayoutHandler and WindowHandler - not one
   Tizen handler. ConfigureTizenControls now registers the concrete types.

   The registration tests were green throughout because they registered
   the Tizen handlers BY HAND, proving only that the handlers work when
   someone wires them up. They now build through the production path
   only, so they would have caught this.

2. TizenManifestFile was declared as an item; Samsung's targets read the
   PROPERTY. An unread item type produces no warning, so the manifest
   would simply have been absent from the .tpk. Now a property, with the
   evaluated value and the file's existence both asserted.

3. TizenLayoutHandler.Update indexed the native child collection with a
   LOGICAL index. The native collection is z-ordered, so once any child
   carried a non-zero ZIndex those diverged and Update disposed a
   different child than the one being replaced, leaving the intended one
   on screen with its handler intact. Now identified by identity, with
   the native view found through its own handler. Tests pin that logical
   and z-ordered positions genuinely diverge - and that they coincide
   when every ZIndex is 0, which is why this looked correct.

4. Timer ticks are posted to the loop, so one can survive Stop and a
   subsequent Start. IsRunning cannot catch that: by delivery time the
   timer is running again, so a stale tick raised a Tick belonging to the
   previous run and, for a one-shot, disarmed the new one. Each tick now
   carries the arming generation it was queued under.

5. Clearing an accessibility annotation left the override applied
   forever: skipping the write on null was not enough, so setting
   IsInAccessibleTree=false and then clearing it left the element
   permanently unreachable. The pre-override state is captured in a weak
   table on first write, and null now restores it.

6. Font point conversion divided by the DISPLAY scale, cancelling
   exactly the scaling ToScaledPixel had applied. Text rendered at its
   unscaled point size while every other dimension scaled - wrong
   precisely where scaling matters. Now divides by the physical dpi, as
   upstream does.

On test coverage, honestly: B3 and B6 both began as `#if TIZEN` code that
no host test can execute, so my first mutation pass on them passed - the
tests could not have failed. B6 is now genuinely covered by extracting
ResolveFontPoint, which the platform code calls; reverting the divisor
fails it. B3 is NOT executed: the fix needs a MauiContext and a native
child. Its tests pin the premise - that logical and z-ordered positions
diverge - rather than the handler behaviour, and I am not claiming more.

B1, B2, B4, B6 are all mutation-verified.

Validation: 399 host tests Debug and Release; three ref-pack lanes build
Release against real TizenFX with the PublicAPI analyzer clean and no
baseline drift; workload-free gate 117 PASS / 0 FAIL; workload transition
suite 52/52; baseline provenance 44/44.

No device lane ran, and none can until Samsung ships the workload.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
MSBuild review of eaabfba:

- The sample set UseMaui/SingleProject, which resolves Microsoft.Maui.Sdk
  and requires the Microsoft MAUI workload. The real lane installs only the
  Samsung tizen workload, so the sample would have failed NETSDK1147 the
  moment the workload gate opened. The external backend must build from
  packages with only the Samsung workload, so the dependency is removed
  rather than the detection weakened.
- Added buildtransitive to the product analyzer reference so the evaluated
  assets match what the ref-pack lanes consume.
- Added a fail-closed parity test over the Tizen versions duplicated in
  eng/Maui.props and Directory.Packages.props.
- GenerateDocumentationFile keyed off a heuristic that misread Core and
  Controls because they set EnableDefaultCompileItems=false. It is now an
  explicit opt-in, set before the TizenPackage.props import.
- Added the appicon.png the sample manifest referenced but never shipped.

Code review of eaabfba:

- The layout replacement fix was incomplete. Update and Insert were
  corrected, but SetVirtualView still filled the logical list from
  OrderByZIndex, so a handler connected to a z-ordered layout began life
  with the same conflation and Update could still dispose an unrelated
  child. The native collection is filled in z-order because that governs
  paint order; the logical list is now filled in logical order. This is
  mutation-verified: restoring the z-ordered fill fails the new tests.
- The timer generation was read from a mutable field when the callback ran,
  so a callback held below the synchronization context until after a
  restart inherited the new generation and consumed the restarted one-shot.
  Each arming now gets its own ITimer and captures its generation in the
  closure. ManualTimeProvider grew HoldCallbacks/ReleaseHeldCallbacks to
  reproduce this, which a synchronous callback cannot.

Honesty notes: mutating Add back to a z-ordered insert does not fail any
test, because GetLayoutHandlerIndex returns the logical index for the cases
covered, making the two forms equivalent there. The logical append is still
correct, but it is not mutation-covered and is not claimed to be. No device
lane ran; disposal ordering remains unverified on hardware.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e23a54a9-6a68-4e30-8920-e2a17fd2ad6a
Register Controls ContentView through the production handler path, keep identity-preserving layout replacement a true no-op, and align the net11 status document with the current validation topology.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7a37339a-ace9-487d-b025-3262b9d414d9
@Redth
Redth merged commit 03562eb into main Aug 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant