Skip to content

Enable Analyzers when building source-only #115397

@ViktorHofer

Description

@ViktorHofer

#115395 showed new CA2025 errors but only in the non-source-only jobs. That's because analyzers are disabled globally when building source-only:

<RunAnalyzers Condition="'$(DotNetBuildSourceOnly)' == 'true'">false</RunAnalyzers>

This setting dates back to dotnet/corefx@7732d6b which disabled analyzers for source-only builds.

This is problematic for various reasons:

  • Creates an artificial difference between source-only and non-source-only builds
  • Diverging behavior form other repositories which don't disable analyzers when building source-only
  • Doesn't get caught in SB's stage2 validation that runs as part of VMR PRs. For the above PR that meant it only get caught in the VMR -> runtime backflow PR and not in the roslyn-analyzers -> VMR forward flow PR.

I propose that we change this setting to only apply to "online" analyzers that don't exist in the source-build graph.

cc @dotnet/source-build @ericstj (as you made the original commit) for opinions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions