We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71b5964 commit e302692Copy full SHA for e302692
1 file changed
src/NuGet.Core/NuGet.ProjectModel/LockFile/LockFileItem.cs
@@ -54,7 +54,21 @@ public bool Equals(LockFileItem other)
54
55
if (string.Equals(Path, other.Path, StringComparison.OrdinalIgnoreCase))
56
{
57
- return Properties.OrderedEquals(other.Properties, pair => pair.Key, StringComparer.Ordinal);
+ // Handle null/empty dictionaries (treat them as equal)
58
+ bool thisEmpty = _properties == null || _properties.Count == 0;
59
+ bool otherEmpty = other._properties == null || other._properties.Count == 0;
60
+
61
+ if (thisEmpty && otherEmpty)
62
+ {
63
+ return true;
64
+ }
65
66
+ if (thisEmpty || otherEmpty)
67
68
+ return false;
69
70
71
+ return _properties.OrderedEquals(other._properties, pair => pair.Key, StringComparer.Ordinal);
72
}
73
74
return false;
0 commit comments