-
Notifications
You must be signed in to change notification settings - Fork 356
Open
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behavior
Description
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
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
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
Metadata
Metadata
Assignees
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behavior