fix: resolve builder StackOverflow, activator negative refCount, binding regression, and testing extensions#4301
Merged
glennawatson merged 6 commits intomainfrom Feb 28, 2026
Merged
Conversation
…ing regression, and testing extensions - Add WithConverter, WithFallbackConverter, WithSetMethodConverter, and WithConvertersFrom to IReactiveUIBuilder interface to prevent infinite recursion in BuilderMixins extension methods (#4293) - Guard ViewModelActivator.Deactivate() against decrementing refCount below zero using CAS loop (#4283) - Relax two-way binding type validation from mutual assignability to one-directional assignability, fixing System.Object bindings (#4298) - Move TestSchedulerExtensions back to ReactiveUI.Testing namespace so AdvanceByMs/AdvanceToMs are discoverable without extra using (#4297)
This was referenced Feb 28, 2026
- Replace async void lambdas with synchronous state capture to fix TUnit0031 on Windows CI where WPF TFMs are built
ChrisPulman
approved these changes
Feb 28, 2026
… snapshots - Add WithFallbackConverter instance/factory/null tests and IReactiveUIBuilder regression test for #4293 - Update DotNet8_0, DotNet9_0, DotNet10_0 API approval snapshots with new interface methods - Fix IsPackable closing tag typo in ReactiveUI.Testing.Reactive.csproj
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4301 +/- ##
==========================================
+ Coverage 89.68% 89.75% +0.07%
==========================================
Files 251 251
Lines 9589 9599 +10
Branches 1457 1460 +3
==========================================
+ Hits 8600 8616 +16
+ Misses 756 749 -7
- Partials 233 234 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
database64128
added a commit
to database64128/youtube-dl-wpf
that referenced
this pull request
Mar 1, 2026
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.
What's Changed
Builder converter registration no longer causes StackOverflow
Calling
WithFallbackConverter,WithConverter,WithSetMethodConverter, orWithConvertersFromonIReactiveUIBuilderpreviously caused aStackOverflowExceptiondue to infinite recursion. These methods now work correctly.ViewModelActivator no longer goes into a broken state on extra Deactivate calls
If
Deactivate()was called more times thanActivate(), the internal reference count would go negative, preventing future activations from working. The activator now safely ignores extra deactivation calls.Two-way bindings work again with base types like System.Object
Two-way bindings between a view model property of a derived type (e.g.
string) and a view property of a base type (e.g.object) were throwingArgumentException. This is now permitted as expected.TestScheduler extensions (AdvanceByMs, AdvanceToMs, etc.) are discoverable again
After adding the
ReactiveUI.Testing.Reactivepackage,AdvanceByMs,AdvanceToMs,OnNextAt, and related extensions are now available with justusing ReactiveUI.Testing;-- no additional namespace import needed.Fixes #4293
Fixes #4283
Fixes #4298
Fixes #4297
Maintainer Notes
WithConverterx4,WithFallbackConverterx2,WithSetMethodConverterx2,WithConvertersFromx1) to the interface. These were previously only on the concreteReactiveUIBuilderclass, causing the extension methods inBuilderMixins.csto resolve back to themselves instead of dispatching to the implementation.Interlocked.DecrementinDeactivate()with a CAS (CompareExchange) loop that refuses to decrement below zero. TheignoreRefCountpath now explicitly resets to 0.&&(mutual) to||(one-directional). The existing fallback conversion logic at lines 180-184 already handles one-directional assignment.ReactiveUI.Testing.ReactivetoReactiveUI.Testing. The assembly/package name remainsReactiveUI.Testing.Reactive-- the move to a separate package is intentional to keepReactiveUI.Testingfree of theMicrosoft.Reactive.Testingdependency.TestReactiveUIBuildermock in Blazor tests, removed now-unnecessaryusing ReactiveUI.Testing.Reactivefrom scheduler tests.