Skip to content

Commit 3b5f82b

Browse files
committed
Bug fix: Equality comparison of values
For reasons that aren't entirely clear, the `==` check isn't using the value comparison when both `value` and `TrackedRecord<String>.Value` are `string`. This is unexpected. As a result, the values are _always_ being seen as having been changed, even when they haven't been. I'd like to investigate this further, as it could suggest behavior that will introduce bugs elsewhere in the library. In the meanwhile, I'm explicitly calling `Equals()` which remedies the problem, and resolves #86.
1 parent 519892b commit 3b5f82b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic/Collections/Specialized/TrackedRecordCollection{TItem,TValue,TAttribute}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ internal void SetValue(
458458
else if (markDirty.HasValue) {
459459
markAsDirty = markDirty.Value;
460460
}
461-
else if (originalItem.Value != value) {
461+
else if (!originalItem.Value?.Equals(value)?? false) {
462462
markAsDirty = true;
463463
}
464464
else if (!version.HasValue) {

0 commit comments

Comments
 (0)