Skip to content

Commit 6d014ba

Browse files
authored
Fix StackOverflowException in ProgressToken.Equals (#229)
1 parent d9b96c4 commit 6d014ba

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Protocol/Models/ProgressToken.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ public ProgressParams Create<T>(T value, JsonSerializer jsonSerializer)
6060
public override bool Equals(object obj)
6161
{
6262
return obj is ProgressToken token &&
63-
EqualityComparer<long?>.Default.Equals(_long, token._long) &&
64-
_string == token._string &&
65-
IsLong == token.IsLong &&
66-
Long == token.Long &&
67-
IsString == token.IsString &&
68-
String == token.String;
63+
this.Equals(token);
6964
}
7065

7166
public override int GetHashCode()
@@ -82,7 +77,12 @@ public override int GetHashCode()
8277

8378
public bool Equals(ProgressToken other)
8479
{
85-
return this.Equals(other);
80+
return EqualityComparer<long?>.Default.Equals(_long, other._long) &&
81+
_string == other._string &&
82+
IsLong == other.IsLong &&
83+
Long == other.Long &&
84+
IsString == other.IsString &&
85+
String == other.String;
8686
}
8787

8888
public bool Equals(long other)
@@ -95,4 +95,4 @@ public bool Equals(string other)
9595
return this.IsString && this.String == other;
9696
}
9797
}
98-
}
98+
}

0 commit comments

Comments
 (0)