Skip to content

Improve Roslyn analyzer configuration for better performance and compliance#39

Merged
mfogliatto merged 2 commits intomainfrom
fix-roslyn-warnings
Sep 14, 2025
Merged

Improve Roslyn analyzer configuration for better performance and compliance#39
mfogliatto merged 2 commits intomainfrom
fix-roslyn-warnings

Conversation

@mfogliatto
Copy link
Copy Markdown
Owner

@mfogliatto mfogliatto commented Sep 14, 2025

Description

This PR improves the Roslyn analyzer configuration by adding two method calls to enhance performance and align with Microsoft's best practices for Roslyn analyzers:

  • Added context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None) to skip analyzing auto-generated code
  • Added context.EnableConcurrentExecution() to allow the analyzer to run in parallel with other analyzers

It also includes an update to Copilot instructions files to ensure style rules are enforced on agent generated code.

Type of change

  • Enhancement (e.g. new feature, functional improvement, etc.)
  • Bug fix
  • Chore (e.g. refactoring, documentation, etc.)

Related Issue

Fixes #36

How Has This Been Tested?

  • Full solution build completed successfully (dotnet build src/ReferenceCop.sln)
  • All unit tests pass (100/100 tests successful with dotnet test src/ReferenceCop.sln)
  • No breaking changes to existing functionality
  • Verified the analyzer compiles correctly with the new configuration

Additional context

N/A

- Add ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None) to skip analyzing auto-generated code
- Add EnableConcurrentExecution() to allow parallel execution with other analyzers
- Aligns with Microsoft's best practices for Roslyn analyzers
- Improves build performance and prevents potential analyzer warnings

Fixes #36
@mfogliatto mfogliatto merged commit 93c5a5e into main Sep 14, 2025
2 checks passed
@mfogliatto mfogliatto deleted the fix-roslyn-warnings branch September 14, 2025 12:07
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

Successfully merging this pull request may close these issues.

Improve Roslyn analyzer configuration for better performance and compliance

1 participant