From 2c57ca2bc4472da4611639be9c49845b80ec53d9 Mon Sep 17 00:00:00 2001 From: barapiiro Date: Tue, 28 May 2024 15:52:05 +0300 Subject: [PATCH] fix hashcode recursion only for the recursive case (anchor) --- YamlDotNet/RepresentationModel/YamlMappingNode.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/YamlDotNet/RepresentationModel/YamlMappingNode.cs b/YamlDotNet/RepresentationModel/YamlMappingNode.cs index 49d793f6..b356f88c 100644 --- a/YamlDotNet/RepresentationModel/YamlMappingNode.cs +++ b/YamlDotNet/RepresentationModel/YamlMappingNode.cs @@ -297,7 +297,9 @@ public override int GetHashCode() foreach (var entry in children) { hashCode = CombineHashCodes(hashCode, entry.Key); - hashCode = CombineHashCodes(hashCode, entry.Value.Start); + hashCode = entry.Value.Anchor.IsEmpty + ? CombineHashCodes(hashCode, entry.Value) + : CombineHashCodes(hashCode, entry.Value.Anchor); } return hashCode; }