Skip to content

chore(analyzers)!: adopt the 3.45.0 analyzer baseline - #68

Open
glennawatson wants to merge 4 commits into
mainfrom
chore/analyzer-baseline-and-tuple-element-casing
Open

chore(analyzers)!: adopt the 3.45.0 analyzer baseline#68
glennawatson wants to merge 4 commits into
mainfrom
chore/analyzer-baseline-and-tuple-element-casing

Conversation

@glennawatson

@glennawatson glennawatson commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Build and maintenance, with one breaking change to the public surface.

What is the new behavior?

The repo builds against the 3.45.0 analyzer baseline and the shared .editorconfig, and public tuple element names are PascalCase.

  • Tuple element names on the public surface are PascalCase. WhenAnyValue, WhenChanged and WhenChanging return (T1 Property1, T2 Property2, ...) for arities 2 through 16, and Bind returns IReactiveBinding<TView, (object? View, bool IsViewModel)>.
    • The generator emits the same casing, so the generated fast path and RuntimeObservationFallback no longer disagree about what an element is called.
  • StyleSharp, PerformanceSharp and SecuritySharp move to 3.45.0, and the code conforms to the rules that brings with it.
    • SST1461 is enabled as an error. It found six parameters no body ever read, one of them only after removing the first orphaned its caller's argument.
    • Vendor rules that report a defect one of ours already reports are turned off, so a single finding is not reported twice.
  • Microsoft.Maui.Controls on net11 moves to 11.0.0-preview.7.26406.9, which is the version the MAUI workload that builds that leg expects. Roslyn stays pinned at the 4.8.0 shipping floor, so the minimum consumer SDK is unchanged.
  • DependencyObjectObservableForProperty has tests. It had none. The teardown that unhooks the value-changed handler on dispose was entirely unexercised.
  • Two rules are scoped rather than satisfied.
    • SST2334 is off for tests and benchmarks: a fixture or a harness is read through assertions, not a debugger summary. Product code still enforces it.
    • SST2461 is suppressed on the DynamicallyAccessedMemberTypes polyfill, whose values must stay numerically identical to the BCL enum the newer targets type-forward to.

What is the current behavior?

  • Analyzers sit at 3.39.2 and the repo predates the shared .editorconfig.
  • Public tuple elements are camelCase (x.property1, x.view), and disagree with RuntimeObservationFallback, which already returned PascalCase elements.
  • Microsoft.Maui.Controls on net11 is pinned to preview.6.
  • Unused parameters are effectively unenforced. The built-in rule configured to report them no longer ships, and the other rule that would have covered them was turned off on the stated grounds that the first one handled it.
  • InitialEmitCompetitor in the initial-emit serialization test claims its turn with a plain bool check-then-set. Two threads can pass it, which throws out of the source's event handler or stalls instead of reporting the emission sequence - in the test that exists to catch exactly that class of race.

What might this PR break?

  • Renaming public tuple elements is a source break for consumers. A caller reading x.property1 or x.view must read x.Property1 or x.View. Element names are metadata only, so existing binaries keep working and only recompilation is affected.
  • Generated output changes. Consumers who assert on generated text will see the new element casing, and the dispatch line numbers move for any fixture whose call site shifted.
  • Nothing else changes at runtime. The scheduler seam, the dispatch mechanism and the lean / .Reactive split are untouched.

Checklist

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

Most of the diff is mechanical; the hand-written parts are a short list.

Mechanical, and safe to skim:

  • Regenerated *.g.verified.cs snapshots - element casing, plus dispatch line numbers and their derived method-name hashes.
  • [MethodImpl(MethodImplOptions.AggressiveInlining)] attributes and their imports, applied where the analyzer reported them.
  • The tuple element renames themselves, across the wide-arity and selector files.

Worth actual review:

  • .editorconfig, src/tests/.editorconfig, src/benchmarks/.editorconfig, src/Directory.Packages.props
  • CodeGeneration/BindCodeGenerator.cs and CodeGeneration/ObservationCodeGenerator.cs - the two places the generator emitted tuple element names as literals
  • The parameters SST1461 removed, in CommandExtractor, SymbolHelpers, BindToInvocationGenerator, WhenAnyCodeGenerator, ObservationCodeGenerator and BindingInvocationAnalyzer
  • Polyfills/DynamicallyAccessedMemberTypes.cs - the suppression and its justification
  • Observables/PropertyChangingObservableInitialEmitSerializationTests.cs - the latch now uses Interlocked.Exchange
  • Wpf.Tests/DependencyObjectObservableForPropertyTests.cs - new, and serialized because the tests share one static DependencyProperty
  • Wpf.Shared/BooleanToVisibilityTypeConverter.cs - restructured into an early-exit guard; both original branch expressions are preserved verbatim

Not covered here: CommandExtractor.ResolveExplicitEventName keeps a partially covered branch, for a toEvent argument that is present but is not a non-empty compile-time constant. Covering it needs a new shared scenario plus its snapshot set across four target frameworks.

- Move StyleSharp, PerformanceSharp and SecuritySharp to 3.43.2 and take the
  shared .editorconfig, then clear the diagnostics that surfaced.
- PascalCase every tuple element name on the public surface. WhenAnyValue,
  WhenChanged and WhenChanging now return (T1 Property1, ...) and Bind returns
  (object? View, bool IsViewModel).
- Move Microsoft.Maui.Controls on net11 to 11.0.0-preview.7.26406.9, matching
  the workload that builds it. Roslyn stays pinned at the 4.8.0 shipping floor.
- Relax SST2334 for tests and benchmarks. A fixture or harness is read through
  assertions, not a debugger summary; product code keeps the rule.
- Suppress SST2461 on the DynamicallyAccessedMemberTypes polyfill. Its values
  must stay identical to the BCL enum the newer targets type-forward to.
- Replace a racy bool latch in the initial-emit serialization test with
  Interlocked.Exchange. Two threads could pass it and mask the race it guards.

BREAKING CHANGE: public tuple element names are now PascalCase. A caller
reading x.property1 or x.view must read x.Property1 or x.View instead. Tuple
element names are metadata only, so this is a source break, not a binary one.
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.18699% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.85%. Comparing base (92f770d) to head (40e53a7).

Files with missing lines Patch % Lines
...nding.SourceGenerators/Helpers/CommandExtractor.cs 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   97.56%   97.85%   +0.28%     
==========================================
  Files         228      228              
  Lines        7840     7822      -18     
  Branches     1077     1071       -6     
==========================================
+ Hits         7649     7654       +5     
+ Misses        143      119      -24     
- Partials       48       49       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add tests for DependencyObjectObservableForProperty, which had none: affinity
  scoring, change notification, teardown on dispose, and the two rejection paths.
- Disposing the subscription is the case that mattered. It unhooks the
  value-changed handler, and nothing was exercising it.
- Serialized with [NotInParallel]: the tests share one static DependencyProperty
  and AddValueChanged registers into a process-wide table keyed by it, so running
  them in parallel races on that table.
- Update StyleSharp, PerformanceSharp and SecuritySharp to 3.44.0, which adds
  SST2337 and fixes SST1503 and SST2266 misfires.
- Enable SST2337 as an error. It found five parameters no body ever read, plus a
  sixth once the first removal orphaned its caller's argument.
- Turn off the vendor rules that report the same defects as ours, so a single
  finding is not reported twice. CA1801 was among them and no longer ships at
  all, which left its stale justification on IDE0060 pointing at nothing.
- Retire SST1461 in favour of SST2337, which covers private parameters and more.
- Mark the Roslyn predicate tokens in RoslynHelpers as discards. The delegate
  shape fixes those signatures, and the rule's method-group exemption only sees
  same-file usages.
- Collapse three GenerateRuntimeFallback tests into one. They differed only by
  the arguments removed here, so they had been asserting the same thing.
@glennawatson glennawatson changed the title chore(analyzers)!: adopt the 3.43.2 analyzer baseline chore(analyzers)!: adopt the 3.44.0 analyzer baseline Aug 15, 2026
@sonarqubecloud

Copy link
Copy Markdown

- Update StyleSharp, PerformanceSharp and SecuritySharp to 3.45.0, which folds
  SST2337 into SST1461 and drops SST2337.
- Enable SST1461, now the single rule for a parameter no body reads, and remove
  the SST2337 entry along with the two duplicate notes that pointed at it.
- Restore the cancellation tokens in RoslynHelpers to their real names. The rule
  now exempts a member carrying any attribute, and those already carry one, so
  the discards are no longer needed.
@glennawatson glennawatson changed the title chore(analyzers)!: adopt the 3.44.0 analyzer baseline chore(analyzers)!: adopt the 3.45.0 analyzer baseline Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant