CLI 'fix' doesn't cover diagnostics that 'analyze' does
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 294
- Avg merge
- 2h 30m
- Merged PRs (30d)
- 4
Description
I ran `analyze` for CS8600 and got a list of warnings, then simply changed `analyze` to `fix` and it neither reported the warnings nor changed the code. I was using diagnostic verbosity as instructed by the 'fix --diagnostic-fixer-map' documentation, "Set verbosity to 'diagnostic' to see which diagnostics cannot be fixed due to multiple fixers." I also tried including a few other args like `--diagnostics-fixable-one-by-one "CS8600"`, `--diagnostic-fix-map "CS8600="`, and `WorkdaySOAP.csproj`, but those attempts resulted in no difference in the output.
Compare these in a diff tool:
```
> roslynator analyze --supported-diagnostics "CS8600" --verbosity diagnostic
Roslynator Version: 0.11.0.0
Roslynator Target Framework: .NET Core
Roslyn Version: 4.14.0.0
Available MSBuild locations:
.NET Core SDK, Version: 7.0.410, Path: C:\Program Files\dotnet\sdk\7.0.410
.NET Core SDK, Version: 8.0.121, Path: C:\Program Files\dotnet\sdk\8.0.121
.NET Core SDK, Version: 9.0.304, Path: C:\Program Files\dotnet\sdk\9.0.304
MSBuild location is 'C:\Program Files\dotnet\sdk\9.0.304'
Loading project 'D:\Src\WorkdaySoapTest\WorkdaySOAP\WorkdaySOAP.csproj'...
Evaluate 00:01.03 WorkdaySOAP.csproj
Build 00:00.53 WorkdaySOAP.csproj
Resolve 00:00.35 WorkdaySOAP.csproj (net8.0)
Analyze 'WorkdaySOAP'
Loaded analyzer assembly 'Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Version=10.0.12.35903, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Loaded analyzer assembly 'Microsoft.CodeAnalysis.NetAnalyzers, Version=10.0.12.35903, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Loaded analyzer assembly 'Microsoft.Interop.ComInterfaceGenerator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Loaded analyzer assembly 'Microsoft.Interop.LibraryImportGenerator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Loaded analyzer assembly 'System.Text.RegularExpressions.Generator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
No analyzers found to analyze 'WorkdaySOAP'
SecurityUtility.cs(66,36): warning CS8600: Converting null literal or possible null value to non-nullable type.
SecurityUtility.cs(71,38): warning CS8600: Converting null literal or possible null value to non-nullable type.
SecurityUtility.cs(103,38): warning CS8600: Converting null literal or possible null value to non-nullable type.
SecurityUtility.cs(114,36): warning CS8600: Converting null literal or possible null value to non-nullable type.
SoapEnvelopeUtility.cs(25,32): warning CS8600: Converting null literal or possible null value to non-nullable type.
SoapEnvelopeUtility.cs(28,34): warning CS8600: Converting null literal or possible null value to non-nullable type.
SoapEnvelopeUtility.cs(43,44): warning CS8600: Converting null literal or possible null value to non-nullable type.
UsernameTokenUtility.cs(34,28): warning CS8600: Converting null literal or possible null value to non-nullable type.
UsernameTokenUtility.cs(37,30): warning CS8600: Converting null literal or possible null value to non-nullable type.
UsernameTokenUtility.cs(52,40): warning CS8600: Converting null literal or possible null value to non-nullable type.
Analyzed project 'D:\Src\WorkdaySoapTest\WorkdaySOAP\WorkdaySOAP.csproj' (in 4.6 s)
10 CS8600 Converting null literal or possible null value to non-nullable type.
10 diagnostics found
```
```
> roslynator fix --supported-diagnostics "CS8600" --verbosity diagnostic
Roslynator Version: 0.11.0.0
Roslynator Target Framework: .NET Core
Roslyn Version: 4.14.0.0
Available MSBuild locations:
.NET Core SDK, Version: 7.0.410, Path: C:\Program Files\dotnet\sdk\7.0.410
.NET Core SDK, Version: 8.0.121, Path: C:\Program Files\dotnet\sdk\8.0.121
.NET Core SDK, Version: 9.0.304, Path: C:\Program Files\dotnet\sdk\9.0.304
MSBuild location is 'C:\Program Files\dotnet\sdk\9.0.304'
Loading project 'D:\Src\WorkdaySoapTest\WorkdaySOAP\WorkdaySOAP.csproj'...
Evaluate 00:02.73 WorkdaySOAP.csproj
Build 00:01.85 WorkdaySOAP.csproj
Resolve 00:01.45 WorkdaySOAP.csproj (net8.0)
Analyze 'WorkdaySOAP'
Loaded analyzer assembly 'Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Version=10.0.12.35903, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Loaded analyzer assembly 'Microsoft.CodeAnalysis.NetAnalyzers, Version=10.0.12.35903, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Loaded analyzer assembly 'Microsoft.Interop.ComInterfaceGenerator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Loaded analyzer assembly 'Microsoft.Interop.LibraryImportGenerator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Loaded analyzer assembly 'System.Text.RegularExpressions.Generator, Version=8.0.12.26602, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
No analyzers and fixers found
Analyzed project 'D:\Src\WorkdaySoapTest\WorkdaySOAP\WorkdaySOAP.csproj' (in 13.0 s)
0 diagnostics fixed
```
Using CLI version 0.11.0.0 that I just installed via `dotnet tool install -g roslynator.dotnet.cli` on Windows 11.
Contributor guide
Research direction
Start with the roslynator analyze and fix CLI entry points and the --diagnostic-fixer-map documentation, then reproduce the report using --supported-diagnostics CS8600 --verbosity diagnostic against WorkdaySOAP.csproj. Done means the fix command accounts for the diagnostics reported by analyze, or the unsupported case is clearly identified in the CLI behavior or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100