Skip to content

Commit

Permalink
Fix Crossgen2 compilation failures in several type generator tests
Browse files Browse the repository at this point in the history
As the PR

#44041

effectively decoupled OwningType from Method in MethodWithToken,
I believe we now need to include OwningType in the Equals check,
otherwise we may (and sometimes do) crash in the assertion failure
checking that OwningType matches between instances.

Thanks

Tomas
  • Loading branch information
trylek committed Apr 12, 2021
1 parent 355eff5 commit 66b6ed2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ public override int GetHashCode()

public bool Equals(MethodWithToken methodWithToken)
{
bool equals = Method == methodWithToken.Method && Token.Equals(methodWithToken.Token) && ConstrainedType == methodWithToken.ConstrainedType &&
Unboxing == methodWithToken.Unboxing;
bool equals = Method == methodWithToken.Method && Token.Equals(methodWithToken.Token)
&& OwningType == methodWithToken.OwningType && ConstrainedType == methodWithToken.ConstrainedType
&& Unboxing == methodWithToken.Unboxing;
if (equals)
{
Debug.Assert(OwningTypeNotDerivedFromToken == methodWithToken.OwningTypeNotDerivedFromToken);
Expand Down

0 comments on commit 66b6ed2

Please sign in to comment.