Skip to content

Commit b7a89bf

Browse files
committed
Merge branch 'bugfix/TrackedRecord-IsDirty' into release/5.1.0
Fixed a bug where a calling `SetValue()` with the same value that an existing record was set to would mark the record as `IsDirty`. Only changes in `Value` should result in `IsDirty`. This seems to stem from an issue with the `==` operator on `T` not using the `==` from `String`, even when `T` is of type `String`. This is an unexpected scenario, and will require further investigation. In the meanwhile, using `Equals()` solves #86.
2 parents 519892b + 3b5f82b commit b7a89bf

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)