Skip to content

Support consistent XAML type references - #39890

Merged
kubaflo merged 2 commits into
mainfrom
stephanedelcroix-investigate-issue-25231
Nov 5, 2026
Merged

kubaflo merged 2 commits into
mainfrom
stephanedelcroix-investigate-issue-25231

Conversation

@StephaneDelcroix

Copy link
Copy Markdown
Contributor

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 from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

  • Resolve bare type names for System.Type values in runtime XAML and SourceGen, while preserving explicitly specified type converters.
  • Support bare x:Array element types and {x:Type ...} in generic type arguments, including nested markup extensions and locally scoped namespace aliases.
  • Report invalid or unresolved type names and add runtime/SourceGen regression coverage. No XamlC-specific changes are included.

Validation

  • Passed: dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v q -clp:ErrorsOnly.
  • Passed (20 tests): dotnet test src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj -c Debug --no-restore -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false --filter 'FullyQualifiedName~Maui25231' --logger 'console;verbosity=normal' -v q -clp:ErrorsOnly.
  • Passed (2,172; 8 skipped): LC_ALL=en_US.UTF-8 dotnet test src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj -c Debug --no-build --no-restore -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false --logger 'console;verbosity=minimal' -v q -clp:ErrorsOnly.

Under the machine's default locale, two existing decimal-binding tests fail because they parse comma-formatted values using invariant culture. The same tests pass with LC_ALL=en_US.UTF-8.

Issues Fixed

Fixes #25231

Copilot AI balanced review requested due to automatic review settings November 4, 2026 12:12
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39890

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39890"

@azure-pipelines

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The parser mistakes a nested TypeName= for an outer assignment, rejecting a supported x:TypeArguments expression and causing inconsistent behavior between runtime XAML and SourceGen.

1 open issue
What changed in this PR

This PR addresses #25231 by making XAML type-reference syntax more consistent across .NET MAUI’s runtime loader and source generator, without XamlC-specific changes.

Changes:

  • Resolve bare names for System.Type values and array element types while preserving explicit converters.
  • Support {x:Type ...} in generic arguments and respect locally scoped namespace aliases.
  • Improve invalid-type diagnostics and add runtime/SourceGen regression tests.
File Description
src/​Controls/​tests/​Xaml.UnitTests/​Issues/​Maui25231.rtsg.xaml.cs Tests type resolution, converter precedence, errors, and namespace scope.
src/​Controls/​tests/​Xaml.UnitTests/​Issues/​Maui25231.rtsg.xaml Supplies runtime/SourceGen cases for supported type-reference forms.
src/​Controls/​src/​Xaml/​TypeArgumentsParser.cs Parses type extensions and validates type expressions.
src/​Controls/​src/​Xaml/​ExpandMarkupsVisitor.cs Handles nested type extensions in runtime generic arguments.
src/​Controls/​src/​SourceGen/​XmlTypeExtensions.cs Handles unresolved generic arguments without constructing invalid symbols.
src/​Controls/​src/​SourceGen/​Visitors/​ExpandMarkupsVisitor.cs Handles nested type extensions in generated generic arguments.
src/​Controls/​src/​SourceGen/​Visitors/​CreateValuesVisitor.cs Resolves bare array element types and improves errors.
src/​Controls/​src/​SourceGen/​TypeConverters/​TypeTypeConverter.cs Uses shared parsing for generated type conversions.
src/​Controls/​src/​SourceGen/​NodeSGExtensions.cs Adds fallback conversion for System.Type values.
src/​Controls/​src/​SourceGen/​KnownMarkups.cs Reports unresolved relative-source ancestor types.
src/​Controls/​src/​SourceGen/​CodeBehindCodeWriter.cs Resolves named-field generic arguments using local namespaces.
src/​Controls/​src/​Core/​Xaml/​TypeConversionExtensions.cs Adds runtime type-name conversion when no explicit converter exists.

Review effort: Balanced

@StephaneDelcroix
StephaneDelcroix changed the base branch from main to net11.0 November 4, 2026 12:37
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 4, 2026
@azure-pipelines

This comment has been minimized.

Copilot AI balanced review requested due to automatic review settings November 4, 2026 12:59
@StephaneDelcroix
StephaneDelcroix had a problem deploying to skill-evaluation-pat-pool November 4, 2026 13:00 — with GitHub Actions Failure
@StephaneDelcroix
StephaneDelcroix had a problem deploying to skill-evaluation-pat-pool November 4, 2026 13:00 — with GitHub Actions Failure
StephaneDelcroix and others added 2 commits November 4, 2026 14:01
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@StephaneDelcroix
StephaneDelcroix force-pushed the stephanedelcroix-investigate-issue-25231 branch from 29893ad to 1d93433 Compare November 4, 2026 13:03
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Skill Validation Results

@StephaneDelcroix — new skill validation results are available based on this last commit: 29893ad.
To request a fresh validation after new comments or commits, comment /evaluate-skills.

Overall Needs attention Static Passed LLM Needs attention Skills 28 Agents 7

⚠️ Skill Validation Results — 29893ad · Support consistent XAML type references · 2026-11-04T13:04:12Z

✅ Static Checks Passed

Skills: 28 | Eval specs linted: 17

Full lint output
── .github/skills/agentic-labeler/tests/eval.vally.yaml
npm warn deprecated @opentelemetry/sdk-trace-node@2.12.0: Use @opentelemetry/sdk-trace package
npm warn deprecated @opentelemetry/sdk-trace-base@2.12.0: Use @opentelemetry/sdk-trace package
Vally collects pseudonymous usage telemetry (command name, version, outcome, duration, persistent device identifier (when available), and coarse OS/runtime info) to improve the product. No prompts, datasets, file paths, or arguments are collected.
Opt out any time by setting VALLY_TELEMETRY_OPTOUT=1 or DO_NOT_TRACK=1.
Learn more: https://aka.ms/vally/telemetry
✔ .github/skills/agentic-labeler/tests/eval.vally.yaml is valid
── .github/skills/analyze-sessions/tests/eval.vally.yaml
✔ .github/skills/analyze-sessions/tests/eval.vally.yaml is valid
── .github/skills/ci-fix/tests/eval.ownership.vally.yaml
✔ .github/skills/ci-fix/tests/eval.ownership.vally.yaml is valid
── .github/skills/ci-fix/tests/eval.vally.yaml
✔ .github/skills/ci-fix/tests/eval.vally.yaml is valid
── .github/skills/code-review/tests/eval.inline-findings.vally.yaml
✔ .github/skills/code-review/tests/eval.inline-findings.vally.yaml is valid
── .github/skills/code-review/tests/eval.producer-trace.vally.yaml
✔ .github/skills/code-review/tests/eval.producer-trace.vally.yaml is valid
── .github/skills/code-review/tests/eval.trim-aot.vally.yaml
✔ .github/skills/code-review/tests/eval.trim-aot.vally.yaml is valid
── .github/skills/code-review/tests/eval.vally.yaml
✔ .github/skills/code-review/tests/eval.vally.yaml is valid
── .github/skills/code-review/tests/hermeticity.vally.yaml
✔ .github/skills/code-review/tests/hermeticity.vally.yaml is valid
── .github/skills/code-review/tests/soak.capability.vally.yaml
✔ .github/skills/code-review/tests/soak.capability.vally.yaml is valid
── .github/skills/evaluate-pr-tests/tests/eval.vally.yaml
✔ .github/skills/evaluate-pr-tests/tests/eval.vally.yaml is valid
── .github/skills/pr-review/tests/eval.gh-auth.vally.yaml
✔ .github/skills/pr-review/tests/eval.gh-auth.vally.yaml is valid
── .github/skills/review-test-failures/tests/eval.vally.yaml
✔ .github/skills/review-test-failures/tests/eval.vally.yaml is valid
── .github/skills/try-fix/tests/eval.restore.vally.yaml
✔ .github/skills/try-fix/tests/eval.restore.vally.yaml is valid
── .github/skills/try-fix/tests/eval.vally.yaml
✔ .github/skills/try-fix/tests/eval.vally.yaml is valid
── .github/skills/verify-tests-fail-without-fix/tests/eval.protocol.vally.yaml
✔ .github/skills/verify-tests-fail-without-fix/tests/eval.protocol.vally.yaml is valid
── .github/skills/verify-tests-fail-without-fix/tests/eval.vally.yaml
✔ .github/skills/verify-tests-fail-without-fix/tests/eval.vally.yaml is valid

⚠️ LLM Evaluation Incomplete

No valid JUnit suite results were found for: review-test-failures.

🔍 Full results and investigation steps

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the runtime XAML and source-generator type-reference consistency changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 4, 2026
@kubaflo

This comment has been minimized.

This was referenced Nov 24, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

s/agent-gate-failed AI could not verify tests catch the bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should we adopt consistent syntax for TypeArguments and Type too?

4 participants