.specify/memory/constitution.md
All public API surfaces MUST align with the WinUI 3 / WinAppSDK API contracts. Deviations from WinUI behavior are permitted ONLY when:
Rationale: Uno Platform's value proposition is write-once WinUI code. API drift erodes developer trust and breaks existing WinUI applications ported to Uno.
Every feature MUST work consistently across all supported target platforms: WebAssembly, iOS, Android, Windows (Win32), Linux, macOS, and native Windows (WinUI). Uno Platform supports Skia and native rendering, where Skia is the primary, and native is legacy - new features may not work 100% on native, but they should not break existing Uno Platform apps using native rendering. Platform-specific behavior MUST be:
.skia.cs,
.wasm.cs, .Android.cs, .iOS.cs, .UIKit.cs).Rationale: Cross-platform consistency is the core promise. Gaps that are invisible to contributors become user-facing regressions.
All changes MUST include runtime tests in
src/Uno.UI.RuntimeTests/. The expected
workflow is:
Build and test MUST pass before any PR is considered mergeable:
dotnet build with the appropriate solution filter.Rationale: The framework has 141+ controls across 6+ platforms. Untested changes create compounding risk that is expensive to diagnose after the fact.
Changes to hot paths (rendering, layout, input, property system) MUST NOT introduce measurable regressions in:
Contributors SHOULD provide before/after measurements for changes affecting these areas. Allocations in per-frame code paths MUST be justified.
Rationale: Uno targets resource-constrained environments (mobile, WebAssembly). Small regressions compound across the control library and are difficult to attribute after merge.
Files under Generated/ folders are produced by automated tooling
and MUST NOT contain functionality. They may only be edited to change the #if directives to mark APIs as implemented. To implement a generated stub:
[Uno.NotImplemented]
attribute and adjust #if accordingly.Rationale: Manual edits to generated files are silently overwritten, causing confusion and lost work. Enforcing this boundary eliminates an entire class of contributor mistakes.
Breaking changes MUST:
feat! or fix! conventional commit.BREAKING CHANGE:.sRationale: Downstream applications depend on stable APIs. Undocumented breaks force upgrade friction that damages ecosystem adoption.
When implementing features or fixing bugs that correspond to WinUI behavior, contributors SHOULD consult the original WinUI C++ sources to understand the reference implementation. Specifically:
This principle is RECOMMENDED (not mandatory) but becomes essential for complex control behavior, edge-case handling, and state machine logic where WinUI's implementation details matter.
Rationale: Uno aims for behavioral parity with WinUI. Guessing at behavior instead of reading the source leads to subtle differences that surface as bugs in production applications.
The Uno Platform uses a layered platform abstraction that MUST be respected in all contributions:
Rendering Engines:
Platform Base Class Rules:
ViewGroup -> UnoViewGroup (Java) ->
BindableView -> UIElement.UIView -> BindableUIView -> UIElement.DependencyObject is an interface on Android/iOS (not a base
class). Source generators provide the implementation.Platform-Specific Code Isolation:
.Android.cs, .iOS.cs,
.skia.cs, .wasm.cs, .reference.cs).ApiExtensibility pattern for runtime Skia platform specialization.#if conditional compilation directives in shared code SHOULD be
avoided in favor of platform-suffixed files.Project Organization:
XamlFileGenerator), not .xbf binary format.Build Validation (run after every change):
dotnet build with the matching solution filter and
crosstargeting_override.props.dotnet test for affected unit test projects.SamplesApp Registration (CRITICAL for new samples):
src/SamplesApp/UITests.Shared/UITests.Shared.projitems.[Sample] attribute MUST be applied to the code-behind class.Conventional Commits (MANDATORY):
<type>[optional scope]: <description>fix, feat, docs, test, chore, feat!Build Safety:
obj/, bin/, and restore when encountering stale asset
errors.This constitution is the authoritative reference for development principles in the Uno Platform Core repository. It supersedes conflicting guidance in other documents.
Amendments:
Compliance:
Runtime Guidance:
AGENTS.md serves as the authoritative runtime development guide
for AI agents and developers. It operationalizes these principles
with concrete commands, paths, and patterns.Version: 1.0.0 | Ratified: 2026-02-09 | Last Amended: 2026-02-09