Skip to content

Commit b0262cf

Browse files
authored
refactor(builder)!: remove BuilderMixins members shadowed by IReactiveUIBuilder (#4498)
## Summary **`BuilderMixins` no longer repeats members that `IReactiveUIBuilder` already declares.** - **30 extension members are removed.** Each had the same name and a compatible parameter list as an `IReactiveUIBuilder` member, so `builder.X(...)` always called the interface member and the extension was reachable only as `BuilderMixins.X(builder, ...)`. - **`ForCustomPlatform` now has one behaviour.** The removed extension ran the platform registrations at once. The interface member, which every `builder.ForCustomPlatform(...)` call already used, runs them at build. - **The members that add something stay.** `RegisterViews`, `WithViewModule`, `WithConverters`, `UsingSplatBuilder` and `BuildApp` on `IAppBuilder` are unchanged. ## Why **The removed extensions were dead public API, and one of them disagreed with the member it shadowed.** - C# only looks for an extension member when no instance member applies. For a receiver typed `IReactiveUIBuilder` or `ReactiveUIBuilder` the instance member always applies, so these extensions were never chosen. `BuilderMixins.ForCustomPlatform(builder, ...)` registered the platform services straight away, while `builder.ForCustomPlatform(...)` deferred them to build. Closes #4488 ## Breaking changes **These `BuilderMixins` members are removed. Call the `IReactiveUIBuilder` member of the same name instead.** - `WithTaskPoolScheduler` (both overloads), `WithMainThreadScheduler` (both overloads), `WithRegistrationOnBuild`, `WithRegistration`, `WithViewsFromAssembly`, `WithPlatformModule`, `UsingSplatModule`. - `WithConverter` (all four overloads), `WithFallbackConverter` (both overloads), `WithSetMethodConverter` (both overloads), `WithConvertersFrom`. - `ForCustomPlatform`, `ForPlatforms`, `WithMessageBus` (all three overloads), `ConfigureViewLocator`, `ConfigureSuspensionDriver`. - `RegisterViewModel`, `RegisterConstantViewModel`, `RegisterSingletonViewModel`, `RegisterView`, `RegisterSingletonView`. - Code written as `builder.X(...)` compiles and behaves as before. Only the static form `BuilderMixins.X(builder, ...)` breaks. A caller that used `BuilderMixins.ForCustomPlatform(builder, ...)` and relied on the registrations existing before `Build()` must call `WithRegistration` for them instead. ## How this was verified **A Roslyn binding probe calls every former `BuilderMixins` member by extension syntax on `IReactiveUIBuilder`, `ReactiveUIBuilder` and `IAppBuilder` receivers; every call compiles and binds to the same method before and after the change.** - Tests that called the removed members through the static form now call the interface members. The `ForCustomPlatform` test also checks that the registrations appear only at build. The documentation examples, including the `rxappbuilder` page, build and run against the change. ## Notes for the reviewer **The change is deletions in `src/ReactiveUI.Shared/Mixins/BuilderMixins.cs`, shared by the lean and `.Reactive` flavours.** - `UsingSplatBuilder` stays because `IReactiveUIBuilder` has no such member, so the extension is what an `IReactiveUIBuilder`-typed caller gets. `BuildApp` stays because its receiver is Splat's `IAppBuilder`. - `WithViewsFromAssembly` keeps its `RequiresUnreferencedCode` annotation on the interface member and on `ReactiveUIBuilder`. - `ReactiveUI` and `ReactiveUI.Reactive` have no committed public API baselines on `main`, so there is no baseline to update. - The test edits are mechanical: `BuilderMixins.X(builder, ...)` becomes `builder.X(...)`, and the null-builder checks for removed members are gone. ## Checklist - [x] I have read the [Contribute guide](https://www.reactiveui.net/contribute/index.html) - [x] The PR title follows [Conventional Commits](https://www.conventionalcommits.org/) - [x] Tests cover this change, or the summary says why they do not - [x] New or changed public API has XML documentation
1 parent 21fb115 commit b0262cf

4 files changed

Lines changed: 54 additions & 571 deletions

File tree

0 commit comments

Comments
 (0)