diff --git a/tests/dotnet-msbuild/build-perf-diagnostics/AnalyzerHeavy.csproj b/tests/dotnet-msbuild/build-perf-diagnostics/Contoso.WebApi.csproj similarity index 64% rename from tests/dotnet-msbuild/build-perf-diagnostics/AnalyzerHeavy.csproj rename to tests/dotnet-msbuild/build-perf-diagnostics/Contoso.WebApi.csproj index 9bff3b9586..0f24654514 100644 --- a/tests/dotnet-msbuild/build-perf-diagnostics/AnalyzerHeavy.csproj +++ b/tests/dotnet-msbuild/build-perf-diagnostics/Contoso.WebApi.csproj @@ -1,11 +1,10 @@ - net8.0 - enable + Contoso.WebApi - + diff --git a/tests/dotnet-msbuild/build-perf-diagnostics/HeavyClass.cs b/tests/dotnet-msbuild/build-perf-diagnostics/DataService.cs similarity index 74% rename from tests/dotnet-msbuild/build-perf-diagnostics/HeavyClass.cs rename to tests/dotnet-msbuild/build-perf-diagnostics/DataService.cs index 7b7e138a52..fd3f04c62e 100644 --- a/tests/dotnet-msbuild/build-perf-diagnostics/HeavyClass.cs +++ b/tests/dotnet-msbuild/build-perf-diagnostics/DataService.cs @@ -1,10 +1,16 @@ -namespace AnalyzerHeavy; +using Microsoft.Extensions.Logging; -/// -/// A class with enough code to make analyzers do meaningful work. -/// -public class HeavyClass +namespace Contoso.WebApi; + +public class DataService { + private readonly ILogger _logger; + + public DataService(ILogger logger) + { + _logger = logger; + } + private readonly Dictionary> _data = new(); public void AddValues(string key, params int[] values) @@ -28,6 +34,7 @@ public IReadOnlyDictionary GetCounts() public string GenerateReport() { + _logger.LogInformation("Generating report for {Count} keys", _data.Count); var sb = new System.Text.StringBuilder(); foreach (var (key, values) in _data) { diff --git a/tests/dotnet-msbuild/build-perf-diagnostics/Directory.Build.props b/tests/dotnet-msbuild/build-perf-diagnostics/Directory.Build.props index 18fcce40d4..22cc77aec1 100644 --- a/tests/dotnet-msbuild/build-perf-diagnostics/Directory.Build.props +++ b/tests/dotnet-msbuild/build-perf-diagnostics/Directory.Build.props @@ -3,15 +3,13 @@ net8.0 enable enable - - - - + true + true + true true latest-recommended - diff --git a/tests/dotnet-msbuild/build-perf-diagnostics/eval.yaml b/tests/dotnet-msbuild/build-perf-diagnostics/eval.yaml index be492fba00..58a2e28383 100644 --- a/tests/dotnet-msbuild/build-perf-diagnostics/eval.yaml +++ b/tests/dotnet-msbuild/build-perf-diagnostics/eval.yaml @@ -1,17 +1,17 @@ scenarios: - - name: "Analyze analyzer performance impact on builds" - prompt: "Build this project and analyze its build performance. Review the full build infrastructure including Directory.Build.props. Identify bottlenecks and suggest specific MSBuild property configurations to improve dev inner loop build times while preserving CI quality enforcement." + - name: "Diagnose slow build for a small project" + prompt: >- + This .NET project's build time is unacceptable for its size. + Systematically diagnose where build time is being spent and recommend + targeted fixes. setup: copy_test_files: true assertions: - - type: "output_contains" - value: "RunAnalyzers" - type: "output_matches" - pattern: "(analyzer|Analyzer)" + pattern: "(RunAnalyzers|analyzer|Analyzer)" rubric: - - "Identified all analyzer packages including those from GlobalPackageReference in Directory.Build.props" - - "Explained that analyzers significantly increase Csc compilation time" - - "Suggested using RunAnalyzers property to conditionally disable analyzers during dev inner loop" - - "Identified EnforceCodeStyleInBuild should be conditional on CI, not always true" - - "Solution preserves full analyzer enforcement in CI pipelines while speeding dev builds" - timeout: 160 + - "Identified that Roslyn analyzers are consuming a disproportionate share of build time" + - "Found analyzer packages in both Directory.Build.props (GlobalPackageReference) and the project file" + - "Recommended using RunAnalyzers property to conditionally disable analyzers in the dev inner loop" + - "Proposed making EnforceCodeStyleInBuild conditional on CI environment while preserving enforcement in CI pipelines" + timeout: 360