C# 10 file scoped namespaces

  • Community Edition Version 8.9.3 (build 48735) C# Analyzer
    Error: Move ‘AddProductToDomainCommandHandler’ into a named namespace.

SonarQube doesn’t support C# 10 file scoped namespaces:


namespace Vision.API.Application.Commands.AddProductToDomain;
public class AddProductToDomainCommandHandler : IRequestHandler<AddProductToExistingDomainCommand>
{

}

Hi @JulienMarpault ,

Welcome to the community! Support for this was added in SonarQube 9.2.

If you want to stay with the LTS release path, you should update to 8.9.6 asap (8.9.3 has a major vulnerability due to log4j), and disable this rule until the next LTS release comes out; likely towards the end of 2022. Alternatively, you can update to the current 9.3 release, where file-scoped namespaces are supported properly.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.