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
I'm experiencing a curious behavior using dotnet format --verify-no-changes command and I also managed to reproduce it in a new project from scratch using .NET core 8 (version 8.0.201).
Take the following C# record definition as reference
public record MyRecord(string A, string B, long C);
if you create an interface in the same C# project and implement it in the record, dotnet format works like a charm
public interface IMyInterface
{
string A { get; }
string B { get; }
long C { get; }
}
public record MyRecord(string A, string B, long C) : IMyInterface;`
BUT (🍑)... If the same interface comes from another class library project created using VB.NET
Public Interface IMyInterfaceVB
ReadOnly Property A As String
ReadOnly Property B As String
ReadOnly Property C As Long
End Interface
dotnet format --verify-no-changes now fails throwing a warning
warning CA1067: Type DotnetFormatCA1067Bug.MyRecord should override Equals because it implements IEquatable
and dotnet format effectively tries to implement Equals method on the record
public record MyRecord(string A, string B, long C) : IMyInterfaceVB
{
public override bool Equals(object obj)
{
return Equals(obj as MyRecord);
}
}
Am I missing something? 🤔
For reference:
dotnet build doesn't raise any warning about CA1067 even using the VB.NET interface
I'm currently using <AnalysisLevel>latest-recommended</AnalysisLevel> in my projects
The text was updated successfully, but these errors were encountered:
Hi,
I'm experiencing a curious behavior using
dotnet format --verify-no-changes
command and I also managed to reproduce it in a new project from scratch using .NET core 8 (version8.0.201
).Take the following C#
record
definition as referencepublic record MyRecord(string A, string B, long C);
if you create an interface in the same C# project and implement it in the record,
dotnet format
works like a charmBUT (🍑)... If the same interface comes from another class library project created using VB.NET
dotnet format --verify-no-changes
now fails throwing a warningand
dotnet format
effectively tries to implementEquals
method on the recordAm I missing something? 🤔
For reference:
dotnet build
doesn't raise any warning about CA1067 even using the VB.NET interface<AnalysisLevel>latest-recommended</AnalysisLevel>
in my projectsThe text was updated successfully, but these errors were encountered: