diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs index 54b08649d46636..1777d292bfb0cc 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs @@ -191,8 +191,8 @@ private static bool TryGetGuid(INamedTypeSymbol interfaceSymbol, InterfaceDeclar public override int GetHashCode() { - // ContainingSyntax and ContainingSyntaxContext do not implement GetHashCode - return HashCode.Combine(Type, TypeDefinitionContext, InterfaceId); + // ContainingSyntax does not implement GetHashCode + return HashCode.Combine(Type, ThisInterfaceKey, BaseInterfaceKey, TypeDefinitionContext, InterfaceId); } public bool Equals(ComInterfaceInfo other) diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ContainingSyntaxContext.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ContainingSyntaxContext.cs index 69b2e1c02b58c5..59028310e6ff32 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ContainingSyntaxContext.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ContainingSyntaxContext.cs @@ -79,7 +79,7 @@ public override int GetHashCode() int code = ContainingNamespace?.GetHashCode() ?? 0; foreach (ContainingSyntax containingSyntax in ContainingSyntax) { - code ^= containingSyntax.Identifier.Value.GetHashCode(); + code = HashCode.Combine(code, containingSyntax.Identifier.Value); } return code; } diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManagedTypeInfo.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManagedTypeInfo.cs index 193dab83f8f764..366e13f61c5247 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManagedTypeInfo.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManagedTypeInfo.cs @@ -25,7 +25,7 @@ public virtual bool Equals(ManagedTypeInfo? other) public override int GetHashCode() { - return FullTypeName.GetHashCode() ^ DiagnosticFormattedName.GetHashCode(); + return HashCode.Combine(FullTypeName, DiagnosticFormattedName); } protected ManagedTypeInfo(ManagedTypeInfo original) diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManualTypeMarshallingHelper.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManualTypeMarshallingHelper.cs index a714ff4c43ede8..439c2b3e46d106 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManualTypeMarshallingHelper.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManualTypeMarshallingHelper.cs @@ -37,7 +37,7 @@ public override int GetHashCode() int hash = 0; foreach (KeyValuePair mode in Modes) { - hash ^= mode.Key.GetHashCode() ^ mode.Value.GetHashCode(); + hash = HashCode.Combine(hash, mode.Key, mode.Value); } return hash; }