Describe the bug
The source generator project's helper struct EquatableArray will cause a stack overflow if object.Equals() is called.
This is because Equals(this, foo) will call object.Equals(), resulting in an infinite loop.
We need to call the typed version from IEquatable<T> instead.
Regression
No response
Steps to reproduce
Add this test to CommunityToolkit.Mvvm.SourceGenerators Test_SourceGeneratorsCodegen.cs to confirm:
[TestMethod]
public void EquatableArrayTest()
{
object a = new EquatableArray<string>();
var b = new EquatableArray<string>();
Assert.AreEqual(a, b);
}
Before the fix, it will cause a stack overflow.
Expected behavior
You would expect the test to pass without a stack overflow.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
Nuget package version(s)
8.4.0
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
Describe the bug
The source generator project's helper struct
EquatableArraywill cause a stack overflow ifobject.Equals()is called.This is because
Equals(this, foo)will callobject.Equals(), resulting in an infinite loop.We need to call the typed version from
IEquatable<T>instead.Regression
No response
Steps to reproduce
Add this test to CommunityToolkit.Mvvm.SourceGenerators
Test_SourceGeneratorsCodegen.csto confirm:Before the fix, it will cause a stack overflow.
Expected behavior
You would expect the test to pass without a stack overflow.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
Nuget package version(s)
8.4.0
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item