When using [LoggerMessage] and source generator for logs, sonar doesn’t find the generated code. CS8795: Partial method '...' must have an implementation part because it has accessibility modifiers.
dotnet-sonarscanner 5.5.3
Sonar TargetFramework .net5.0
The same build without sonar on same agent is working.
As an update there is a pretty complicated workaround by patching the SonarQubeAnalysisConfig.xml and add a new AnalyzerPlugin entry where I added a path to the Microsoft.Extensions.Logging.Generators.dll.
For the Razor I saw that there was a fix by adding the reference in the securitycsharpfrontend plugin. What about all other analyzers/sourcegenerators ? It should be a more flexible way of including the in the build process.
Update for other forum users: currently, if you want to use Roslyn source generators in your builds, don’t set sonar.cs.roslyn.ignoreIssues=true.
The default is false, so it will only be true if it has been explicitly modified (see the scanner docs for more info). The setting tells the SonarScanner for .NET to remove non-Sonar analyzers from the compilation. Unfortunately, Roslyn source generators are registered in the same way as analyzers, so they are removed from the build too. This issue is being tracked in S4NET-1211.