Repository navigation
fix: resolve short scheduler names, report unusable [ReactiveCommand] methods, and convert properties to partial properties - #505
Merged
Conversation
… methods, and convert properties to partial properties [ReactiveCommand] OutputScheduler and BackgroundScheduler names are bound as C# at the attribute, so "RxSchedulers.MainThreadScheduler" resolves through the file's usings; before, only a member of the class or a fully qualified name worked and anything else was dropped without a word. A static member elsewhere is written fully qualified, and the scheduler type is the one the ReactiveUI command factories take. A new ReactiveCommandAnalyzer reports what the generator skips, from the same ReactiveCommandRules file the generator compiles: RXUISG0002 for a method with more than one parameter besides a CancellationToken, RXUISG0008 for an async void method, both restored with their original meaning, and RXUISG0021 for a scheduler name that does not resolve. The RXUISG0016 code fix makes a [Reactive] partial property, and its containing types partial, from C# 13 (C# 14 with an initializer) when the compiler's generator build supports partial properties; otherwise it makes a [Reactive] field as before. Analyzer release tracking records every rule change in AnalyzerReleases.Shipped.md under Release 4.0, including the removal of RXUISG0001 to RXUISG0008 from the generator; the Unshipped files stay empty.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #505 +/- ##
==========================================
+ Coverage 96.55% 96.70% +0.15%
==========================================
Files 72 74 +2
Lines 3653 3759 +106
Branches 506 531 +25
==========================================
+ Hits 3527 3635 +108
+ Misses 126 124 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Scheduler names resolve as written,
[ReactiveCommand]methods and schedulers the generator skips are reported, and the RXUISG0016 fix makes a[Reactive]partial property.OutputSchedulerandBackgroundSchedulernames are bound as C# at the attribute."RxSchedulers.MainThreadScheduler"resolves through the file's usings, as do members of the class and fully qualified names; a static member elsewhere is written fully qualified.ReactiveCommandAnalyzerreports what the command generator skips. RXUISG0002 for a method with more than one parameter besides a CancellationToken, RXUISG0008 for anasync voidmethod, and RXUISG0021 (warning) for a scheduler name that does not resolve.ReactiveCommandRulesfile. What the analyzer reports is exactly what the generator skips.[Reactive]partial property. It makes the containing types partial too, from C# 13, or C# 14 when the property has an initializer; otherwise it makes a[Reactive]field as before.Release 4.0inAnalyzerReleases.Shipped.md, including the removal of RXUISG0001 to RXUISG0008 from the generator.Why
Several
[ReactiveCommand]mistakes produced no command, or a command without its scheduler, and no diagnostic."RxSchedulers.MainThreadScheduler"was silently ignored: only a class member or aglobal::name worked, so aBackgroundSchedulercommand did not run in the background.async voidmethod got a command that could not observe it; RXUISG0001 to RXUISG0008 were still listed as shipped although nothing reported them.[Reactive]field, whose property exists only in generated code that other generators, such as ReactiveUI.Binding's, cannot see.Breaking changes
New diagnostics can now fail a build that compiled before.
Taskinstead ofasync void.How this was verified
Tests cover every rule the analyzer reports and every case it must not, the scheduler forms in generated output, and the code fix at C# 12, 13 and preview, compiling its output with the
[Reactive]generator.Schedulersnapshot, which uses"RxSchedulers.MainThreadScheduler", recorded the dropped scheduler and now shows it; no other snapshot changed.Notes for the reviewer
Start with
ReactiveCommandRules.cs; the generator and analyzer changes are thin callers of it.outputSchedulerparameter, so each ReactiveUI flavour gets its own without separate API detection.CLAUDE.mdnow says analyzer rules are recorded inAnalyzerReleases.Shipped.mdonly.Checklist