Build Roslyn-first framework-neutral XAML compiler#35
Merged
Conversation
wieslawsoltes
marked this pull request as ready for review
July 24, 2026 05:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ProGPU.WinUI.Themes.Fluent, compiling and packaging the unchanged external Microsoft UI XAMLgeneric.xamlWhy
ProGPU needs one high-performance, extensible XAML compiler core that can serve WinUI first and later Avalonia, WPF, MAUI, and custom dialects without duplicating parser, type-system, workspace, formatting, or generation infrastructure. Generated C# is constructed exclusively as Roslyn syntax nodes rather than emitted as strings.
Current status
This is intentionally a draft and remains under active development. Ordinary
{Binding}and compiled{x:Bind}have distinct bound/IR models and independent transactional lifetimes. Typed ordinary source inference covers lexicalx:DataType, literals, exactx:Static,RelativeSource Self, same-namescopeElementName, profile-resolvedRelativeSource TemplatedParent, and exact local or external resource-graph sources.The shared
netstandard2.0markup language has an immutable versioned plugin registry. Framework and user plugins declare contexts, triggers, precedence, associativity, capabilities, and conflict policy; token recognition is trigger-indexed; custom root and attribute syntax projects into the canonical AST and normal infoset pipeline; and registered formatting/generation inverses must parse and structurally round-trip before publication.The downstream immutable Roslyn extension host supports ordered bound-document transforms, bound validators over the enriched resource graph, audited construction-program transforms, and markup-expression handlers that return only structured
ExpressionSyntax. Framework and caller extensions share one deterministic order, strict bounded audits, explicit diagnostics, and cancellation.Generator, direct, Workspace, and CLI hosts share one compilation-dependent semantic-manifest compiler. It resolves build metadata/resource identity, applies profile/caller transforms, and derives dependency manifests from the accepted document. Workspace compilation removes only prior reserved
*.ProGPU.Xaml.g.cstrees before rebinding. Generated identities use canonical SHA-256 and final C# is deterministic BOM-free UTF-8.The parser has snapshotted limits, a 1,024 absolute depth ceiling, long-token cancellation, deterministic malformed-input lossless fuzzing, excessive-depth recovery, and bounded-allocation tests. Bounded inspection services expose the exact canonical syntax/token/infoset/bound/resource/transformed-IR/generated-syntax stages to the CLI and playground without a display-only compiler pipeline.
The playground uses cancellable versioned background inspection and explicit-permission live preview. It derives edited
x:Classand root types through the neutral type system, synthesizes hosts entirely as Roslyn syntax, emits in-memory PE images without C# parse-back, gates dynamic loading on runtime support, validates typed WinUI roots in collectible contexts, and swaps through canonical state transfer with last-good retention.Project-context preview is implemented in the reusable Workspaces layer. It accepts an immutable Roslyn
Project/XAMLAdditionalDocumentplus optional unsavedSourceText, preserves real C# parse options, compiles every recognized sibling XAML document against one semantic resource index, and emits one complete structured-tree PE without mutating the Workspace. The standaloneprogpu-xaml previewcommand exposes this throughMSBuildWorkspaceand transactional output; it compiles the real six-document ProGPU sample project with zero visible diagnostics.Immutable project-delta planning matches documents by canonical resource URI, distinguishes formatting-only, semantic target, unrelated sibling, imported-resource-provider, and host-metadata changes, and exposes stable infoset/projection identity deltas from accepted structured Roslyn trees. Unrelated sibling changes do not churn the visible target. A stateful prepare/apply/commit coordinator compiles outside its lock, serializes host publication, rejects stale/foreign/invalid candidates before invoking the publisher, and advances its last-good comparison baseline only after success. The WinUI adapter validates and activates a collectible candidate before coordinating metadata, publishes through canonical state transfer, and commits the compiler generation only after runtime success. Missing or failed metadata coordination and invalid artifacts retain both the last good tree and comparison baseline.
The unchanged Fluent corpus emits and compiles with zero diagnostics against the completed public template-settings contracts. Remaining MVP gates include broader multi-file diagnostics/manifest/linked-item/checkout-root host equivalence, parser fuzz/performance baselines, IDE/playground project selection and watch integration, namescope-aware fine-grained template patching, resource-generation invalidation, a Roslyn metadata-delta producer, and collection-root replacement.
Validation
dotnet test src/ProGPU.Xaml.Tests/ProGPU.Xaml.Tests.csproj -c Release --no-restore— 243 passeddotnet test src/ProGPU.Tests/ProGPU.Tests.csproj --no-restore— 2347 passed at the last full runtime checkpointdotnet test src/ProGPU.Tests/ProGPU.Tests.csproj -c Release --filter FullyQualifiedName~HotReload --no-restore— 16 passeddotnet test src/ProGPU.Tests.Headless/ProGPU.Tests.Headless.csproj -c Release --no-restore— 197 passed at the last headless checkpointdotnet build tools/ProGPU.Xaml.Cli/ProGPU.Xaml.Cli.csproj -c Release --no-restore— zero warnings/errors at the last CLI checkpointprogpu-xaml preview ...XamlCompilerWelcomePage.xaml --project ...ProGPU.Samples.csproj --json— committed a complete six-document project preview PE with zero visible diagnostics./eng/progpu-verify-docs.sh— succeededdotnet build src/ProGPU.slnx --no-restore— succeeded at the last full solution checkpointProGPU.WinUI.Themes.Fluentpack succeeded; source and packagedGeneric.xamlremain byte-identical with SHA-2564c4085838721c0afcb1a9ee17591c0655cdddadb26d330788e08bcd7f1af8285