DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.61k stars 506 forks source link

SA1402 doesn't recognize records #3852

Closed Arthri closed 1 month ago

Arthri commented 1 month ago

The following does not trigger SA1402 "file may only contain a single type", when it should

namespace Z
{
    internal record class X
    {
    }

    internal class Y
    {
    }
}
bjornhellander commented 1 month ago

I can not reproduct this, using the latest version (1.2.0-beta.556). What version are you using?

Arthri commented 1 month ago

I am using 1.1.118

bjornhellander commented 1 month ago

That one is from 2019 and has obvious problems with new language features. The recommendation is to use the latest beta version if you want to use modern c#.

bjornhellander commented 1 month ago

Duplicate of #3542

Arthri commented 1 month ago

Apologies for the duplicate issue. I've updated to the latest beta and can no longer reproduce this. Thanks for the advice!