Scanner/analyzer/publisher stoped reporting issues from .net 5 code

Ok, after a good few tens of messages with Andrei and his colleague Pawel we have finally managed to find the root cause:

we have pipeline tasks like this:

  - task: DotNetCoreCLI@2
    displayName: Restore packages
    inputs:
      command: 'restore'
      projects: |
        ./src/**/*.csproj
        ./test/**/*.csproj

  - task: DotNetCoreCLI@2
    displayName: Build
    inputs:
      command: 'build'
      arguments: '-p:Version="..." -p:GeneratePackageOnBuild="false" -p:InformationalVersion="...'
      projects: ./src/**/*.csproj

  - task: DotNetCoreCLI@2
    displayName: Run tests
    inputs:
      arguments: '--no-restore /p:CollectCoverage=true /p:GeneratePackageOnBuild="false" /p:CoverletOutputFormat=opencover --logger trx /p:RunAnalyzers="false"'
      command: 'test'
      publishTestResults: false
      projects: ./test/**/*.csproj

Notice the "/p:RunAnalyzers="false". For .net core 3.1 projects this was working as expected as during the build there were few (duplicate) warnings outputed so this switch off analysis fixed the “double” analysis.

However for .net 5.0 this stopped working. It was probably not related to the tool upgrade, it might have not been working “never ever” for .net 5.0 projects.