Skip to content

fix: dispose the displaced binding when BindCommandUnsafe rebinds; build without runtime-async - #165

Merged
glennawatson merged 1 commit into
mainfrom
fix/bindcommand-dispose-displaced-binding
Oct 3, 2026
Merged

glennawatson merged 1 commit into
mainfrom
fix/bindcommand-dispose-displaced-binding

Conversation

@glennawatson

@glennawatson glennawatson commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

BindCommandUnsafe and BindInteractionUnsafe now keep one live binding per call, and the .NET 11 build no longer uses runtime-async.

  • The runtime command and interaction fallbacks dispose the binding they replace when a link in the control chain changes.
  • The .NET 11 assemblies are built without runtime-async, which Mono does not support.
  • The benchmarks build again on ReactiveUI 25, and TUnit is updated to 1.72.16.

Why

Each change notification on a link in the control chain added another live binding. The command then ran once per binding, and the extra bindings stayed attached after the returned disposable was disposed. Closes #163.

Separately, Blazor WebAssembly, Avalonia's browser apps and other Mono hosts can fail on a runtime-async build.

Breaking changes

The .NET 11 assemblies no longer use runtime-async. The public API does not change. This ships as a major release because of the runtime change.

How this was verified

New tests cover repeated link notifications keeping one binding, disposal detaching the command, and a replaced interaction disposing its old registration.

Notes for the reviewer

The fix is the SwapDisposable change in RuntimeCommandBindingFallback and RuntimeInteractionFallback. The generator's emitted code already used SwapDisposable, so it is unchanged. The Directory.Build.props and benchmark edits are mechanical.

Checklist

  • I have read the Contribute guide
  • The PR title follows Conventional Commits
  • Tests cover this change, or the summary says why they do not
  • New or changed public API has XML documentation

@glennawatson
glennawatson force-pushed the fix/bindcommand-dispose-displaced-binding branch from 4409109 to 6a8b03b Compare October 3, 2026 05:21
- RuntimeCommandBindingFallback and RuntimeInteractionFallback hold the current binding in a SwapDisposable, so a rebind disposes the binding it replaces.
- Add tests for one active binding per call and for disposal after a rebind.
- Build the .NET 11 assemblies without runtime-async. Mono does not support it, so it breaks Blazor WebAssembly and other Mono hosts.
- Update TUnit to 1.72.16.
- Fix the benchmarks for ReactiveUI 25: drop an unused using, and let the generated ToProperty name CountViewModel.

Fixes #163

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@glennawatson
glennawatson force-pushed the fix/bindcommand-dispose-displaced-binding branch from 6a8b03b to 95fbd1c Compare October 3, 2026 05:26
@glennawatson glennawatson changed the title fix: dispose the displaced binding when BindCommandUnsafe rebinds fix: dispose the displaced binding when BindCommandUnsafe rebinds; build without runtime-async Oct 3, 2026
@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (b0e6a29) to head (95fbd1c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #165   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files         396      396           
  Lines       14469    14469           
  Branches     2065     2065           
=======================================
  Hits        14359    14359           
  Misses        110      110           

☔ 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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

@glennawatson
glennawatson merged commit 4e74040 into main Oct 3, 2026
24 checks passed
@glennawatson
glennawatson deleted the fix/bindcommand-dispose-displaced-binding branch October 3, 2026 06:04
glennawatson added a commit that referenced this pull request Oct 3, 2026
- RuntimeCommandBindingFallback and RuntimeInteractionFallback hold the current binding in a SwapDisposable, so a rebind disposes the binding it replaces.
- Add tests for one active binding per call and for disposal after a rebind.
- Build the .NET 11 assemblies without runtime-async. Mono does not support it, so it breaks Blazor WebAssembly and other Mono hosts.
- Update TUnit to 1.72.16.
- Fix the benchmarks for ReactiveUI 25: drop an unused using, and let the generated ToProperty name CountViewModel.

Fixes #163
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.

[Bug]: BindCommandUnsafe does not dispose the displaced binding when it rebinds

1 participant