Skip to content

Honor explicit SelfContained=false in binlog detection - #1901

Open
sean0407 wants to merge 1 commit into
microsoft:mainfrom
sean0407:sean0407/1893-explicit-selfcontained
Open

sean0407 wants to merge 1 commit into
microsoft:mainfrom
sean0407:sean0407/1893-explicit-selfcontained

Conversation

@sean0407

Copy link
Copy Markdown

Summary

  • Honor an explicit SelfContained value from the MSBuild binlog before considering the lock-file heuristic; retain PublishAot=true as a positive self-contained signal.
  • Add regression coverage for runtime-pack download metadata that would otherwise classify an explicitly framework-dependent library as self-contained.

Fixes #1893

Reproduction

A library with SelfContained=false can still have Microsoft.NETCore.App.Runtime.* download dependencies in its assets file. With that lock-file metadata and an explicit false binlog value, the detector previously reported library-selfcontained; it should report library. The regression test exercises that metadata and binlog combination.

Changed files

  • src/Microsoft.ComponentDetection.Detectors/nuget/MSBuildBinaryLogComponentDetector.cs
  • test/Microsoft.ComponentDetection.Detectors.Tests/nuget/MSBuildBinaryLogComponentDetectorTests.cs

Validation

  • Detector test project on .NET 8: 997/997 passed.
  • git diff --check passed.

@sean0407
sean0407 requested a review from a team as a code owner October 20, 2026 20:06
@sean0407
sean0407 requested review from Paul Dorsch (pauld-msft) and a balanced review from Copilot October 20, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new precedence can suppress positive AOT signals and misclassify self-contained inner builds.

2 open issues
What changed in this PR

This PR addresses #1893 by making explicit binlog self-containment values override the NuGet lock-file heuristic.

Changes:

  • Adds a nullable binlog decision to distinguish explicit false from missing information.
  • Adds regression coverage for framework-dependent libraries with runtime-pack downloads.
File Description
test/​Microsoft.ComponentDetection.Detectors.Tests/​nuget/​MSBuildBinaryLogComponentDetectorTests.cs Adds the explicit-false regression and runtime-pack fixture.
src/​Microsoft.ComponentDetection.Detectors/​nuget/​MSBuildBinaryLogComponentDetector.cs Prioritizes explicit binlog values over lock-file inference.

Review effort: Balanced

private static bool IsSelfContainedFromProjectInfo(MSBuildProjectInfo projectInfo) =>
projectInfo.SelfContained == true || projectInfo.PublishAot == true;
private static bool? IsSelfContainedFromProjectInfo(MSBuildProjectInfo projectInfo) =>
projectInfo.SelfContained ?? (projectInfo.PublishAot == true ? true : null);
var innerInfo = GetInnerBuildOrDefault(projectInfo, target.TargetFramework);
var targetType = GetTargetType(innerInfo.OutputType);
var isSelfContained = isSelfContainedFromBinlog ||
var isSelfContained = isSelfContainedFromBinlog ??
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.

Framework-dependent libraries with  RuntimeIdentifiers  are misclassified as  library-selfcontained  (false-positive DOTNET-EOL-SC alerts)

2 participants