Uno.XamlParser
0.10.0-dev.74
Prefix Reserved
dotnet add package Uno.XamlParser --version 0.10.0-dev.74
NuGet\Install-Package Uno.XamlParser -Version 0.10.0-dev.74
<PackageReference Include="Uno.XamlParser" Version="0.10.0-dev.74" />
<PackageVersion Include="Uno.XamlParser" Version="0.10.0-dev.74" />
<PackageReference Include="Uno.XamlParser" />
paket add Uno.XamlParser --version 0.10.0-dev.74
#r "nuget: Uno.XamlParser, 0.10.0-dev.74"
#:package Uno.XamlParser@0.10.0-dev.74
#addin nuget:?package=Uno.XamlParser&version=0.10.0-dev.74&prerelease
#tool nuget:?package=Uno.XamlParser&version=0.10.0-dev.74&prerelease
Uno.XamlParser
Uno.XamlParser is a streaming XAML reader/writer pipeline for parsing, validating, and fixing XAML markup. It is designed to accept XAML as a stream and expose a visitor-based pipeline where each stage can observe, mutate, or filter the markup before it reaches the next stage.
Installation
dotnet add package Uno.XamlParser
High-Level Goals
- Accept XAML as a stream (strings,
PipeReader,ReadOnlySequence<char>, etc.). - Expose a visitor-based pipeline where each stage can observe, mutate, or filter the markup before it reaches the next stage.
- Preserve a clear separation between syntax validation, semantic enrichment, and type resolution so tests can pin the behavior of each layer independently.
Pipeline Stages
| Stage | Purpose | Typical Issues Caught |
|---|---|---|
| Stage 0 - Input & Tokenization | Consume raw XML chunks, normalize whitespace, surface lexical tokens, and recover from malformed entities. | Unterminated tags, malformed attributes, stray ampersands, invalid XML declaration. |
| Stage 1 - XAML Semantics | Interpret tokens as XAML constructs (elements, attached properties, markup extensions) and apply structure-aware fixers. | Missing namespace declarations, unsupported markup extension prefixes, WPF-only binding syntax. |
| Stage 2 - Type Resolution | Map {prefix}:{Type} identifiers to IXamlType instances, resolve property names, and recursively resolve nested markup extensions. |
Unknown controls, invalid property casing, non-existent properties, namespace-type mismatches. |
| Stage 3 - Value Semantics | Validate/normalize property values using resolved types (enums, markup extensions, Thickness, GridLength, CornerRadius, Binding/x:Bind, resources, etc.). |
Invalid enum values, unsupported unit suffixes, malformed markup extensions, missing resources. |
Each stage has a reader (pulls/raises events), optional visitors (fixers/analyzers), and a writer (rebuilds XAML) so they can be composed as Reader → Visitors → Writer. If a consumer only needs diagnostics, it can omit the writer entirely.
Processing Policies
All stages respect IXamlProcessingPolicy, which decides whether a given fix/edit is applied or only reported as a diagnostic. Register a preset (see XamlProcessingPolicyPresets) or provide your own implementation via DI. See the Processing Policies spec for detailed guidance.
Specifications
- Streaming Reader Pipeline — Architecture of the multi-stage pipeline
- Structured Diagnostics — Diagnostic data model and code registry (XML0001–SEM3301)
- Processing Policies — Policy configuration and presets
- Type Resolution — Extensible type and property resolution
- Parser Capabilities — Complete inventory of auto-fixes and validations
Documentation
- Diagnostic Reference — All diagnostic codes at a glance
- Implementing Custom Resolvers — Guide for
IXamlTypeResolver,IXamlResourceResolver, and related interfaces
Project Layout
src/Uno.XamlParser— Core streaming abstractions, token structs, readers/writers, visitors/fixer interfaces, and type resolution contracts.src/Uno.XamlParser.Tests— MSTest project that exercises each stage via unit tests, Verify snapshots, and golden files.src/Uno.XamlParser.Runtime— Runtime integration (reflection-basedIXamlTypeResolverandIXamlTypeMetadataProvider).src/Uno.XamlParser.Runtime.Tests— Tests for the reflection-based type resolver and metadata provider.src/Uno.XamlParser.Cli— CLI tool for batch XAML validation and diagnostics reporting.src/Uno.XamlParser.Cli.Tests— Tests for the CLI tool.
Building
dotnet build src/Uno.XamlParser.slnx
dotnet test src/Uno.XamlParser.slnx
License
See LICENSE.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.0-dev.74 | 66,028 | 5/22/2026 |
| 0.10.0-dev.71 | 17,178 | 4/22/2026 |
| 0.10.0-dev.67 | 76 | 4/16/2026 |
| 0.10.0-dev.59 | 73 | 4/16/2026 |
| 0.10.0-dev.54 | 72 | 4/16/2026 |
| 0.10.0-dev.48 | 7,594 | 4/16/2026 |
| 0.10.0-dev.43 | 71 | 4/10/2026 |
| 0.10.0-dev.42 | 66 | 4/10/2026 |
| 0.10.0-dev.41 | 2,565 | 4/9/2026 |
| 0.10.0-dev.38 | 123 | 4/7/2026 |
| 0.10.0-dev.35 | 69 | 4/3/2026 |
| 0.10.0-dev.34 | 67 | 4/3/2026 |
| 0.10.0-dev.31 | 67 | 4/2/2026 |
| 0.10.0-dev.29 | 67 | 4/1/2026 |
| 0.10.0-dev.28 | 3,626 | 3/31/2026 |
| 0.10.0-dev.25 | 103 | 3/30/2026 |