Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Either SA1009 or SA1024 raised for primary constructor with class inheritance #3775

Closed
sobiyang opened this issue Jan 10, 2024 · 2 comments
Closed

Comments

@sobiyang
Copy link

sobiyang commented Jan 10, 2024

In C# 12, if we use primary constructor with class inheritance, then SA1009 is raised. However if we removed the trailing space, it becomes SA1024.

Sample code:

public class ServiceOne(int intervalSeconds) : BackgroundService
   {
       protected override async Task ExecuteAsync(CancellationToken stoppingToken)
       {
           while (!stoppingToken.IsCancellationRequested)
           {
               await Task.Delay(intervalSeconds * 1000, stoppingToken);
           }
       }
   }

Keeping the space:
StyleCop_SA1009
Removing the space:
StyleCop_SA1024

@sobiyang sobiyang changed the title Either SA1009 or SA1024 raised for primary constructor followed by colon Either SA1009 or SA1024 raised for primary constructor with class inheritance Jan 10, 2024
@bjornhellander
Copy link
Contributor

Duplicate of #3248. It should work if you update to the latest beta version.

@sharwell
Copy link
Member

Duplicate of #3248

@sharwell sharwell marked this as a duplicate of #3248 Jan 10, 2024
@sharwell sharwell closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants