fix(api)!: return concrete type from DisposeWith - #168
Merged
Conversation
Implementation: - make the MultipleDisposable overload generic and return the original concrete disposable - preserve the existing IDisposable receiver metadata for the parameterless and action overloads - validate the disposable collection before registration API and tests: - update lean and Reactive public API baselines for every tracked target framework - add TUnit coverage for concrete-type preservation, identity, disposal tracking, and null validation BREAKING CHANGE: DisposeWith(IDisposable, MultipleDisposable) is replaced by DisposeWith<T>(T, MultipleDisposable), so compiled consumers must recompile.
ChrisPulman
marked this pull request as ready for review
August 19, 2026 00:17
glennawatson
approved these changes
Aug 19, 2026
ChrisPulman
enabled auto-merge (squash)
August 19, 2026 00:30
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
- Coverage 98.14% 98.14% -0.01%
==========================================
Files 703 703
Lines 21733 21734 +1
Branches 2679 2678 -1
==========================================
Hits 21330 21330
Misses 199 199
- Partials 204 205 +1 ☔ 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.



What kind of change does this PR introduce?
A breaking API fix that makes the
MultipleDisposableoverload ofDisposeWithpreserve the receiver's concrete disposable type.Closes #152
What is the new behavior?
DisposeWith<T>(T disposable, MultipleDisposable disposables)validates the disposable collection, adds the original item, and returns the sameT. The parameterless and action overloads retain their existingIDisposablereceiver metadata. Lean and Reactive API baselines are updated for every tracked target framework, with TUnit coverage for concrete-type preservation, identity, disposal tracking, and null validation.What is the current behavior?
The
MultipleDisposableoverload returnsIDisposable, losing the receiver's concrete type, and silently accepts a null collection. Compiled consumers of that overload target the old non-generic metadata signature and must recompile for this change.Checklist
Additional information
Validation:
net10.0builds passed with zero warnings and errors.net462builds passed with zero warnings and errors.DisposeWithbody is covered.git diff --checkpassed.BREAKING CHANGE:
DisposeWith(IDisposable, MultipleDisposable)is replaced byDisposeWith<T>(T, MultipleDisposable). Already compiled consumers must recompile. The parameterless and action overloads preserve their existing metadata.