diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/UncommonField.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/UncommonField.cs index 005670a657a..c01e87488ec 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/UncommonField.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/UncommonField.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; using System.Diagnostics; using MS.Internal.WindowsBase; // for FriendAccessAllowed @@ -51,7 +52,7 @@ public void SetValue(DependencyObject instance, T value) EntryIndex entryIndex = instance.LookupEntry(_globalIndex); // Set the value if it's not the default, otherwise remove the value. - if (!object.ReferenceEquals(value, _defaultValue)) + if (!EqualityComparer.Default.Equals(value, _defaultValue)) { instance.SetEffectiveValue(entryIndex, null /* dp */, _globalIndex, null /* metadata */, value, BaseValueSourceInternal.Local); _hasBeenSet = true;