[experiment] Add MSBuild binary log detector as replacement for DotNet and NuGet detectors#1710
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an experimental NuGet/.NET detector that can optionally enrich project.assets.json parsing with MSBuild .binlog-extracted project metadata (e.g., test/shipping/dev flags, SDK version), plus an experiment config and accompanying unit/integration tests.
Changes:
- Introduces
MSBuildBinaryLogComponentDetectoralong withBinLogProcessor,MSBuildProjectInfo, and sharedLockFileUtilities. - Registers the new detector and an experiment (
MSBuildBinaryLogExperiment) in Orchestrator DI. - Adds extensive detector and binlog-processing tests; adds
MSBuild.StructuredLoggerdependency + version pin.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/MSBuildBinaryLogComponentDetectorTests.cs | New unit tests covering fallback vs binlog-enhanced behavior and dev-dependency classification rules. |
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/BinLogProcessorTests.cs | New integration tests that build temp projects to generate/parse .binlog and validate extracted project info. |
| test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj | Adds MSBuild.StructuredLogger test dependency. |
| src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Registers the new experiment config and detector in DI. |
| src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/MSBuildBinaryLogExperiment.cs | Defines control vs experiment grouping for telemetry diffing. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildProjectInfo.cs | New model + merge logic for project metadata and captured items. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildBinaryLogComponentDetector.cs | New experimental detector that orders binlogs first, indexes project info, then processes assets with overrides. |
| src/Microsoft.ComponentDetection.Detectors/nuget/LockFileUtilities.cs | New shared utilities for NuGet lockfile graph traversal + PackageDownload registration. |
| src/Microsoft.ComponentDetection.Detectors/nuget/IBinLogProcessor.cs | New abstraction for binlog project info extraction (testability). |
| src/Microsoft.ComponentDetection.Detectors/nuget/BinLogProcessor.cs | New binlog parser using StructuredLogger events to populate MSBuildProjectInfo. |
| src/Microsoft.ComponentDetection.Detectors/Microsoft.ComponentDetection.Detectors.csproj | Adds MSBuild.StructuredLogger runtime dependency for detector implementation. |
| Directory.Packages.props | Pins MSBuild.StructuredLogger version. |
You can also share your feedback on Copilot code review. Take the survey.
… into binlogDetector
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
You can also share your feedback on Copilot code review. Take the survey.
|
@grvillic as we discussed I think this is ready, let me know if you want to see anything more to get this in as off-by-default |
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Adds an experimental MSBuild binary log–aware detector to improve NuGet + .NET component detection accuracy by using build-time project context from *.binlog files (with fallback to existing project.assets.json-based logic).
Changes:
- Introduces
MSBuildBinaryLogComponentDetectorplus binlog parsing (BinLogProcessor) and project-info model/merge logic (MSBuildProjectInfo). - Refactors shared logic into reusable helpers (
LockFileUtilities,DotNetProjectInfoProvider,PathRebasingUtility) and wires the new detector into Orchestrator + experiments. - Adds extensive unit/integration tests and updates docs + CI/test configuration for Integration test filtering.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/MSBuildBinaryLogComponentDetectorTests.cs | Unit tests for binlog-enhanced vs fallback behavior of the new detector. |
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/BinLogProcessorTests.cs | Integration tests that build real projects and validate binlog extraction/merge behavior. |
| test/Microsoft.ComponentDetection.Detectors.Tests/dotnet/PathRebasingUtilityTests.cs | Unit tests for path normalization/rebasing helpers. |
| test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj | Adds MSBuild.StructuredLogger dependency for tests. |
| test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs | Marks slow, process-spawning tests as Integration. |
| test/Directory.Build.props | Excludes Integration tests by default via MTP filter. |
| src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Registers MSBuildBinaryLogComponentDetector in DI. |
| src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/MSBuildBinaryLogExperiment.cs | Adds experiment config to compare new detector vs existing NuGet/DotNet detectors. |
| src/Microsoft.ComponentDetection.Detectors/nuget/NuGetProjectModelProjectCentricComponentDetector.cs | Refactors lockfile processing to shared LockFileUtilities. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildProjectInfo.cs | New model for MSBuild project properties/items extracted from binlog + merge semantics. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildBinaryLogComponentDetector.cs | New DefaultOff detector combining binlog context with project.assets.json processing. |
| src/Microsoft.ComponentDetection.Detectors/nuget/LockFileUtilities.cs | New shared lockfile graph traversal + self-contained heuristics helpers. |
| src/Microsoft.ComponentDetection.Detectors/nuget/IBinLogProcessor.cs | Interface for binlog-to-project-info extraction. |
| src/Microsoft.ComponentDetection.Detectors/nuget/BinLogProcessor.cs | Implements binlog replay/extraction with optional path rebasing and merge behavior. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/PathRebasingUtility.cs | New utility to rebase build-machine absolute paths to scan-machine roots. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetProjectInfoProvider.cs | Extracted/shared DotNet SDK + project-type registration logic (used by detectors). |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs | Refactors to use DotNetProjectInfoProvider. |
| src/Microsoft.ComponentDetection.Detectors/Microsoft.ComponentDetection.Detectors.csproj | Adds MSBuild.StructuredLogger (and DotNet.Glob) dependencies + InternalsVisibleTo. |
| Directory.Packages.props | Pins MSBuild.StructuredLogger version centrally. |
| docs/feature-overview.md | Documents *.binlog as an (DefaultOff) NuGet input. |
| docs/detectors/nuget.md | Adds documentation for the MSBuildBinaryLog detector behavior and usage. |
| docs/detectors/README.md | Lists MSBuildBinaryLogComponentDetector as DefaultOff under NuGet. |
| CONTRIBUTING.md | Adds guidance on Integration tests and local/CI execution. |
| .github/workflows/build.yml | Attempts to override local Integration-test exclusion in CI test step. |
Copilot's findings
- Files reviewed: 24/24 changed files
- Comments generated: 7
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an experimental MSBuild binary log–based detector to enhance .NET/NuGet component detection by using build-time project metadata (from .binlog) to drive classification and improve accuracy versus artifact-only inference.
Changes:
- Introduces
MSBuildBinaryLogComponentDetectorplusBinLogProcessorto extract project properties/items from MSBuild binlogs and merge multi-pass (build/publish/test) results. - Refactors shared lockfile/self-contained logic into
LockFileUtilitiesand shared DotNet environment logic intoDotNetProjectInfoProvider. - Adds extensive unit + integration coverage and updates docs/CI to support integration-test filtering and artifact debugging.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/MSBuildBinaryLogComponentDetectorTests.cs | Adds unit tests for binlog-enhanced + fallback lockfile processing and dev-dependency classification. |
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/BinLogProcessorTests.cs | Adds integration tests that generate real binlogs and validate extracted MSBuild properties/items + merge behavior. |
| test/Microsoft.ComponentDetection.Detectors.Tests/dotnet/PathRebasingUtilityTests.cs | Adds unit tests for path rebasing/normalization and relative-path matching. |
| test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj | Adds MSBuild.StructuredLogger dependency for tests. |
| test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs | Moves slow tests into Integration category to avoid default local runs. |
| test/Directory.Build.props | Excludes Integration tests by default via Microsoft Testing Platform filter args. |
| src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Registers the new DefaultOff MSBuild binlog detector. |
| src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/MSBuildBinaryLogExperiment.cs | Adds experiment config to compare new detector vs existing NuGet/DotNet detectors. |
| src/Microsoft.ComponentDetection.Detectors/nuget/NuGetProjectModelProjectCentricComponentDetector.cs | Refactors lockfile processing to call shared LockFileUtilities. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildProjectInfo.cs | Adds model for MSBuild-evaluated project metadata + merge semantics for multi-pass builds. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildBinaryLogComponentDetector.cs | Implements binlog discovery + binlog+lockfile combined detection and classification. |
| src/Microsoft.ComponentDetection.Detectors/nuget/LockFileUtilities.cs | Centralizes NuGet lockfile traversal, explicit dep resolution, PackageDownload registration, and self-contained heuristics. |
| src/Microsoft.ComponentDetection.Detectors/nuget/IBinLogProcessor.cs | Introduces interface for binlog project-info extraction (supports mocking). |
| src/Microsoft.ComponentDetection.Detectors/nuget/BinLogProcessor.cs | Implements binlog replay parsing, property/item extraction, path rebasing, and multi-pass merging. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/PathRebasingUtility.cs | Adds reusable path normalization/rebasing utilities for cross-machine artifact paths. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetProjectInfoProvider.cs | Extracts shared DotNet SDK/version/project-type registration logic from DotNet detector. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs | Refactors to delegate to DotNetProjectInfoProvider. |
| src/Microsoft.ComponentDetection.Detectors/Microsoft.ComponentDetection.Detectors.csproj | Adds StructuredLogger package and exposes internals to Moq proxy. |
| docs/feature-overview.md | Documents .binlog support and DefaultOff behavior for NuGet detection. |
| docs/detectors/nuget.md | Documents MSBuildBinaryLog detector behavior, properties, and enablement. |
| docs/detectors/README.md | Lists MSBuildBinaryLogComponentDetector as DefaultOff. |
| Directory.Packages.props | Pins MSBuild.StructuredLogger version. |
| CONTRIBUTING.md | Documents unit vs integration test expectations and local commands. |
| .github/workflows/build.yml | Overrides default Integration-test exclusion in CI and keeps coverage enabled. |
Copilot's findings
- Files reviewed: 24/24 changed files
- Comments generated: 4
- Make integration test filter conditional via ExcludeIntegrationTests property - Update CI and CONTRIBUTING.md to use the new property - Guard GetRebaseRoot against '.' and '..' relative paths - Skip NuGet registration when library version is null instead of using 0.0.0 - Lazy-create MSBuildProjectInfo in ProjectStarted handler - Treat empty strings as unset in MergeWith for path/identity properties - Fix fallback recorder key to use assets file location consistently - Fix test to find NuGet graph by component ID
…-detection into binlogDetector
There was a problem hiding this comment.
Pull request overview
Adds an experimental MSBuild binary log–enhanced detector to improve NuGet/.NET component detection accuracy by using build-time project information from *.binlog files when available, while retaining a lockfile-based fallback.
Changes:
- Introduces
MSBuildBinaryLogComponentDetector(DefaultOff) that merges binlog-extractedMSBuildProjectInfowithproject.assets.jsonprocessing and registers both NuGet + DotNet components. - Refactors shared lockfile and .NET project/SKD inference logic into
LockFileUtilitiesandDotNetProjectInfoProvider, simplifying existing detectors. - Adds extensive new test coverage (including new Integration-test infrastructure defaults) plus documentation updates for the new detector/experiment.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/MSBuildBinaryLogComponentDetectorTests.cs | New unit-style tests for fallback vs binlog-enhanced behavior, plus multi-binlog merge scenarios. |
| test/Microsoft.ComponentDetection.Detectors.Tests/nuget/BinLogProcessorTests.cs | New Integration tests that build real projects to validate binlog parsing. |
| test/Microsoft.ComponentDetection.Detectors.Tests/dotnet/PathRebasingUtilityTests.cs | Tests for path normalization/rebasing used to map build-machine paths to scan-machine paths. |
| test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj | Adds MSBuild.StructuredLogger dependency for tests. |
| test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs | Marks slow process-spawning tests as Integration. |
| test/Directory.Build.props | Excludes Integration tests by default via ExcludeIntegrationTests + Testing Platform filter. |
| src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Registers the new detector in DI. |
| src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/MSBuildBinaryLogExperiment.cs | Adds experiment grouping definition for control vs experiment detectors. |
| src/Microsoft.ComponentDetection.Detectors/nuget/NuGetProjectModelProjectCentricComponentDetector.cs | Refactors NuGet lockfile processing to use shared LockFileUtilities. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildProjectInfo.cs | New model for binlog-derived MSBuild properties/items + merge behavior. |
| src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildBinaryLogComponentDetector.cs | Core new detector: binlog discovery/indexing, enhanced processing, fallback path, DotNet registration. |
| src/Microsoft.ComponentDetection.Detectors/nuget/LockFileUtilities.cs | Shared NuGet lockfile graph traversal + self-contained heuristics utilities. |
| src/Microsoft.ComponentDetection.Detectors/nuget/IBinLogProcessor.cs | Abstraction for extracting project info from binlogs (enables mocking in tests). |
| src/Microsoft.ComponentDetection.Detectors/nuget/BinLogProcessor.cs | Binlog replay/parser using MSBuild.StructuredLogger to extract properties/items and rebase paths. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/PathRebasingUtility.cs | New reusable path rebasing helper (common-suffix root substitution). |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetProjectInfoProvider.cs | Shared DotNet SDK/project-type inference and DotNet component registration logic. |
| src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs | Simplifies DotNet detector by delegating logic to DotNetProjectInfoProvider. |
| src/Microsoft.ComponentDetection.Detectors/Microsoft.ComponentDetection.Detectors.csproj | Adds MSBuild.StructuredLogger dependency and an InternalsVisibleTo for Moq proxy assembly. |
| docs/feature-overview.md | Documents *.binlog (DefaultOff) as part of NuGet detector inputs. |
| docs/detectors/nuget.md | Adds documentation for the MSBuildBinaryLog detector behavior, properties, and enablement. |
| docs/detectors/README.md | Lists the new detector as DefaultOff. |
| Directory.Packages.props | Pins MSBuild.StructuredLogger package version. |
| CONTRIBUTING.md | Documents Integration test conventions and how local/CI execution differs. |
| .github/workflows/build.yml | CI now disables the local default Integration-test exclusion when running tests + coverage. |
Copilot's findings
- Files reviewed: 24/24 changed files
- Comments generated: 3
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
MSBuild logs have much more accurate project information than we can deduce from project build intermediates.
If an MSBuild log is available, we should read it and capture the project information from it, rather than try to deduce that solely from the build artifacts and project.assets.json.