Skip to content

.NET 11 Preview 7 Parallelism Breaks SBOM Generation #14691

Description

@christophwille

Issue Description

We traced the problem in comment icsharpcode/ILSpy#3981 (comment)

The actual build output (we are using Microsoft.Sbom.Targets):

Warning: Unknown error while running CD scan: System.ObjectDisposedException: Cannot write to a closed TextWriter.
   at Microsoft.Build.Experimental.OutOfProcServerNode.RedirectConsoleWriter.Write(String value)
   at System.IO.TextWriter.SyncTextWriter.Write(String value)
   at Spectre.Console.AnsiConsoleBackend.Write(IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/Ansi/AnsiConsoleBackend.cs:line 33
   at Spectre.Console.AnsiConsoleFacade.Write(IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/AnsiConsoleFacade.cs:line 40
   at Spectre.Console.AnsiConsole.Write(IRenderable renderable) in /_/src/Spectre.Console/AnsiConsole.Rendering.cs:line 29
   at Microsoft.ComponentDetection.Orchestrator.Services.DetectorProcessingService.LogTabularOutput(ConcurrentDictionary`2 providerElapsedTime, Double totalElapsedTime)
   at Microsoft.ComponentDetection.Orchestrator.Services.DetectorProcessingService.ProcessDetectorsAsync(ScanSettings settings, IEnumerable`1 detectors, DetectorRestrictions detectorRestrictions, CancellationToken cancellationToken)
   at Microsoft.ComponentDetection.Orchestrator.Services.ScanExecutionService.ExecuteScanAsync(ScanSettings settings, CancellationToken cancellationToken)
   at Microsoft.ComponentDetection.Orchestrator.Commands.ScanCommand.ExecuteScanCommandAsync(ScanSettings settings, CancellationToken cancellationToken)
   at Microsoft.Sbom.Api.Utils.ComponentDetector.ScanAsync(ScanSettings args)
   at Microsoft.Sbom.Api.Utils.ComponentDetectorCachedExecutor.ScanAsync(ScanSettings args)
   at Microsoft.Sbom.Api.Executors.ComponentDetectionBaseWalker.<>c__DisplayClass11_0.<<GetComponents>g__Scan|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Sbom.Api.Executors.ComponentDetectionBaseWalker.<>c__DisplayClass11_0.<<GetComponents>b__1>d.MoveNext()
Warning: There were no packages detected during the generation workflow.

The problem didn't exist in preview6, only started showing up with preview7. @baronfel

Steps to Reproduce

It is reproducible when the ENV var is not set and you pack multiple packages.

Expected Behavior

Continue to work like it did before in preview6.

Actual Behavior

Packages didn't contain SBOM.

Analysis

Setting the ENV var disabling parallelism fixed the problem

Versions & Configurations

.NET 11 Preview 7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions