You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to check records for field types that lack a customised Equals override, or that use reference equality? These fields can cause subtle bugs, and I’m not aware of any way to detect this at present. Eg
public record Info(DirectoryInfo Folder, string Name);
var a = new Info(new DirectoryInfo("."), "test");
var b = new Info(new DirectoryInfo("."), "test");
var same = a == b; // false!
DirectoryInfo has reference semantics, so isn’t suitable for use in records without a custom Equals check.
Is it possible to create a warning for this kind of issue?
The text was updated successfully, but these errors were encountered:
Is it possible to check records for field types that lack a customised Equals override, or that use reference equality? These fields can cause subtle bugs, and I’m not aware of any way to detect this at present. Eg
DirectoryInfo
has reference semantics, so isn’t suitable for use in records without a custom Equals check.Is it possible to create a warning for this kind of issue?
The text was updated successfully, but these errors were encountered: