Skip to content

Fix LWWDictionary.Delta ArgumentNullException when underlying delta is null#7911

Merged
Arkatufus merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:fix/lww-dictionary-null-delta-7910
Oct 16, 2025
Merged

Fix LWWDictionary.Delta ArgumentNullException when underlying delta is null#7911
Arkatufus merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:fix/lww-dictionary-null-delta-7910

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Member

Summary

Fixed a bug where LWWDictionary.Delta would throw ArgumentNullException when the underlying ORDictionary.Delta is null, which is a legitimate state after initialization or calling ResetDelta().

Changes

  • Modified LWWDictionary.Delta property to return null when Underlying.Delta is null
  • Added test Bugfix_7910_LWWDictionary_Delta_should_handle_null_underlying_delta to verify the fix

Root Cause

The LWWDictionary.Delta property was unconditionally wrapping Underlying.Delta in a LWWDictionaryDelta constructor, which throws ArgumentNullException when passed null. However, ORDictionary.Delta can legitimately return null after construction or ResetDelta().

The Replicator expects deltas to be nullable (uses ?? operator at lines 665 and 685 in Replicator.cs), so this fix aligns LWWDictionary with the expected interface contract.

Test Evidence

All 6 LWWDictionarySpec tests pass:

  • 5 existing tests (no regressions)
  • 1 new test verifying null delta handling

Fixes #7910

…s null (akkadotnet#7910)

## Summary
Fixed a bug where LWWDictionary.Delta would throw ArgumentNullException when the underlying ORDictionary.Delta is null, which is a legitimate state after initialization or calling ResetDelta().

## Changes
- Modified LWWDictionary.Delta property to return null when Underlying.Delta is null
- Added test Bugfix_7910_LWWDictionary_Delta_should_handle_null_underlying_delta to verify the fix

## Root Cause
The LWWDictionary.Delta property was unconditionally wrapping Underlying.Delta in a LWWDictionaryDelta constructor, which throws ArgumentNullException when passed null. However, ORDictionary.Delta can legitimately return null after construction or ResetDelta().

The Replicator expects deltas to be nullable (uses ?? operator at lines 665 and 685), so this fix aligns LWWDictionary with the expected interface contract.

Fixes akkadotnet#7910
Copy link
Copy Markdown
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Arkatufus Arkatufus merged commit 5c5ca74 into akkadotnet:dev Oct 16, 2025
11 checks passed
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Oct 16, 2025
…s null (akkadotnet#7910) (akkadotnet#7911)

## Summary
Fixed a bug where LWWDictionary.Delta would throw ArgumentNullException when the underlying ORDictionary.Delta is null, which is a legitimate state after initialization or calling ResetDelta().

## Changes
- Modified LWWDictionary.Delta property to return null when Underlying.Delta is null
- Added test Bugfix_7910_LWWDictionary_Delta_should_handle_null_underlying_delta to verify the fix

## Root Cause
The LWWDictionary.Delta property was unconditionally wrapping Underlying.Delta in a LWWDictionaryDelta constructor, which throws ArgumentNullException when passed null. However, ORDictionary.Delta can legitimately return null after construction or ResetDelta().

The Replicator expects deltas to be nullable (uses ?? operator at lines 665 and 685), so this fix aligns LWWDictionary with the expected interface contract.

Fixes akkadotnet#7910
Aaronontheweb added a commit that referenced this pull request Oct 16, 2025
…s null (#7910) (#7911) (#7912)

## Summary
Fixed a bug where LWWDictionary.Delta would throw ArgumentNullException when the underlying ORDictionary.Delta is null, which is a legitimate state after initialization or calling ResetDelta().

## Changes
- Modified LWWDictionary.Delta property to return null when Underlying.Delta is null
- Added test Bugfix_7910_LWWDictionary_Delta_should_handle_null_underlying_delta to verify the fix

## Root Cause
The LWWDictionary.Delta property was unconditionally wrapping Underlying.Delta in a LWWDictionaryDelta constructor, which throws ArgumentNullException when passed null. However, ORDictionary.Delta can legitimately return null after construction or ResetDelta().

The Replicator expects deltas to be nullable (uses ?? operator at lines 665 and 685), so this fix aligns LWWDictionary with the expected interface contract.

Fixes #7910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] LWWDictionary.Delta throws ArgumentNullException when underlying ORDictionary.Delta is null

2 participants