Repository navigation
Fix XAML diagnostics false positives on valid markup - #403
Chiara Mooney (chiaramooney) wants to merge 4 commits into
Conversation
Accept case-insensitive enum values, inherited object methods and ValueTuple ItemN fields in x:Bind, and report WMC1510 only when the WinUI compiler's EnableBindingDiagnostics is on. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Accept only Item1-Item7 tuple fields, skip object methods on interface receivers, and let object methods through when only an overload with a different parameter count shares the name. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
VSIX Build
Updated 2026-12-01 21:27:22 UTC · commit |
The WinUI compiler only sees real ValueTuple fields, so explicit element names such as Count fail the build. Exclude them from bindable members. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PR reviewSummary: 0 critical, 0 high, 5 medium, 1 low. Security, docs, packaging and alternative-solution checks found no issues. A second model (GPT) independently confirmed M3 and found no missed critical or high issues.
M3: tuple elements named with their default name are rejected (correctness, high confidence)A tuple element named with its default name (
M1: production MSBuild path and plumbing untested (test coverage, high confidence)Production reads the setting from the combined build-and-evaluation MSBuild call (
M2:
|
Accept tuple elements explicitly named ItemN, stop hiding object methods behind same-arity overloads (only overrides hide them), and point named tuple elements at their ItemN field with a quick-fix suggestion. Add coverage that the binding-diagnostics setting survives the production load path and WithClassName. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Thanks for the review. Addressed in adf20c2, apart from M5:
Locally: LanguageServer tests 1150 passed, targeted Workspace tests 81 passed, LSP smoke passed. |
Description
The XAML language server reported errors and warnings on markup that the WinUI XAML compiler accepts. Each case is now silent, matching what
dotnet builddoes:Visibility="collapsed"orMode=oneway(x:Bind and Binding) are no longerWXAML0012/WXAML0022/WXAML0025errors. A lowercaseMode=twowaystill triggers the read-only TwoWay check (WXAML0044).WMC1510(Native AOT warning for an untyped{Binding}in aDataTemplate) now appears only when the project's evaluatedEnableBindingDiagnosticsis true. The WinUI targets turn that on forIsAotCompatibleorPublishAot, so the editor follows the compiler, including explicit overrides.ToString(),Equals(),GetHashCode(),GetType()on class or struct x:Bind receivers are no longer flaggedWXAML0011, even when the class declares its own overloads such asToString(string)orEquals(MyType). Interface receivers are still flagged because the compiler rejects them.Item1toItem7andRestresolve in x:Bind paths (no moreWXAML0005), including elements explicitly namedItem1.Item8and later are still flagged because they are not realValueTuplefields. Named elements such asPair.Countare now flagged too, because the compiler only sees the underlyingItemNfields; the message names the matchingItemNand the replace quick fix offers it.Usage Example
Related Issue
Fixes #354
Type of Change
Checklist
.\scripts\build-vsce.ps1locallyScreenshots / Demo
Not applicable. This changes which diagnostics the language server reports; the observed results are under Additional Notes.
Additional Notes
Validation, run locally on the PR head:
dotnet test server/test/WinUiXaml.LanguageServer.Tests -c Debug: 1150 passed.dotnet test server/test/WinUiXaml.Workspace.Tests -c Debug(type system, binding-diagnostics evaluation and resolution,WithClassName, unbuilt-reference tests): 81 passed.node server/test/lsp-smoke/smoke.mjs(afterdotnet restore test\fixtures\xaml\fixture\SmokeFixture.csproj): passed. The non-AOT fixture now must not reportWMC1510..\scripts\build-vsce.ps1 -Package: compile, lint, unit tests and VSIX packaging passed, including the Native AOT server for each architecture.IsAotCompatible=true, the compiler reportsWMC1510, anddotnet msbuild -getProperty:EnableBindingDiagnosticsreturnstrue(empty otherwise). The same builds confirmed the compiler rejectsItem8on an 8-element tuple, named tuple elements, andToString()on anIDisposable-typed receiver, all of which the server flags.Limitations:
WMC1510; the WinUI targets derivingEnableBindingDiagnosticsfromIsAotCompatiblewas verified manually.{Binding}outside any template. The server has never reported that case and this PR does not add it.x:Namecases from the issue were already fixed onmain; this PR only adds regression test cases for them.AI Description
This section is auto-generated by AI when the PR is opened or updated. To opt out, delete this entire section including the marker comments.