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

RS0031 when using multiple BannedSymbols.txt files #7477

Open
drewnoakes opened this issue Nov 22, 2024 · 0 comments
Open

RS0031 when using multiple BannedSymbols.txt files #7477

drewnoakes opened this issue Nov 22, 2024 · 0 comments

Comments

@drewnoakes
Copy link
Member

Analyzer

Diagnostic ID: RS0031: The symbol '' is listed multiple times in the list of banned APIs

Describe the bug

In dotnet/project-system we use the banned API analyzer. We also have a project that targets net472 and net8.0.

I want to ban an API in net472 only.

To do this, I have something like:

<ItemGroup>
  <AdditionalFiles Include="$(MSBuildThisFileDirectory)src\Common\BannedSymbols.txt" />
  <AdditionalFiles Include="$(MSBuildThisFileDirectory)src\Common\BannedSymbols.net472.txt" Condition="'$(TargetFramework)' == 'net472'" />
</ItemGroup>

With this, I get a bunch of warnings:

3>D:\repos\project-system\src\Common\BannedSymbols.net472.txt(6,1,6,2): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(4,1,4,2): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(3,1,3,10): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(5,1,5,16): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(6,1,6,17): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(7,1,7,16): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(8,1,8,19): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)
3>D:\repos\project-system\src\Common\BannedSymbols.txt(9,1,9,15): warning RS0031: The symbol '' is listed multiple times in the list of banned APIs (https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)

It seems incorrect that the symbol name should be empty. The files don't have anything interesting in them, and if I only use one file then everything works fine. I don't believe this is related to #6633.

I couldn't get this working, regardless of warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant