Skip to content

[browser][docker] DisableParallelEmccCompile - MSB5022: The MSBuild task host does not support running tasks that perform IBuildEngine callbacks #125713

Description

@pavelsavara

Description

The EmccCompile task in .NET 11 preview SDK calls IBuildEngine9.RequestCores(1) which returns 0 in the resource-constrained CI Docker container. The task then calls ReleaseCores(0) which throws ArgumentOutOfRangeException(coresToRelease). Despite MSBuildDisableTaskHost=true being set, the task still runs in the out-of-process task host where IBuildEngine callbacks fail with MSB5022.

Reproduction Steps

/p:MSBuildDisableTaskHost=true /p:DisableParallelEmccCompile=true /p:DisableParallelAot=true

Expected behavior

no error

Actual behavior

dotnet publish: /bench/artifacts/sdks/linux.sdk11.0.100-preview.3.26160.114/dotnet publish /__w/macro-benchmarks/macro-benchmarks/src/micro-benchmarks --no-restore /p:BenchmarkPreset=Aot -c Release /p:RuntimeFlavor=Mono /p:BuildLabel=11.0.100-preview.3.26160.114 /p:MSBuildDisableTaskHost=true /p:DisableParallelEmccCompile=true /p:DisableParallelAot=true -bl:/bench/artifacts/publish/micro-benchmarks/11.0.100-preview.3.26160.114/aot/publish.binlog -o /bench/artifacts/publish/micro-benchmarks/11.0.100-preview.3.26160.114/aot
/bench/artifacts/sdks/linux.sdk11.0.100-preview.3.26160.114/sdk/11.0.100-preview.3.26160.114/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(383,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/__w/macro-benchmarks/macro-benchmarks/src/micro-benchmarks/MicroBenchmarks.csproj]
  MicroBenchmarks -> /__w/macro-benchmarks/macro-benchmarks/artifacts/bin/MicroBenchmarks/11.0.100-preview.3.26160.114/Aot/bin/MicroBenchmarks/release/MicroBenchmarks.dll
  Using BenchmarkPreset: 'Aot'
  Optimizing assemblies for size. This process might take a while.
  AOT'ing 10 assemblies
  [1/10] MicroBenchmarks.dll -> MicroBenchmarks.dll.bc
  [2/10] System.Collections.dll -> System.Collections.dll.bc
  [3/10] System.Console.dll -> System.Console.dll.bc
  [4/10] System.IO.Pipelines.dll -> System.IO.Pipelines.dll.bc
  [5/10] System.Memory.dll -> System.Memory.dll.bc
  [6/10] System.Runtime.InteropServices.JavaScript.dll -> System.Runtime.InteropServices.JavaScript.dll.bc
  [7/10] System.Security.Cryptography.dll -> System.Security.Cryptography.dll.bc
  [8/10] System.Text.Json.dll -> System.Text.Json.dll.bc
  [9/10] System.Private.CoreLib.dll -> System.Private.CoreLib.dll.bc
  [10/10] aot-instances.dll -> aot-instances.dll.bc
  IL stripping assemblies
  Compiling assembly bitcode files with -O2 ...
/bench/artifacts/sdks/linux.sdk11.0.100-preview.3.26160.114/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/11.0.0-preview.3.26160.114/Sdk/WasmApp.Common.targets(831,5): 
error : MSB5022: The MSBuild task host does not support running tasks that perform IBuildEngine callbacks. If you wish to perform these operations, please run your task in the core MSBuild process instead.  A task will automatically execute in the task host if the UsingTask has been attributed with a "Runtime" or "Architecture" value, or the task invocation has been attributed with an "MSBuildRuntime" or "MSBuildArchitecture" value, that does not match the current runtime or architecture of MSBuild. [/__w/macro-benchmarks/macro-benchmarks/src/micro-benchmarks/MicroBenchmarks.csproj]
/bench/artifacts/sdks/linux.sdk11.0.100-preview.3.26160.114/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/11.0.0-preview.3.26160.114/Sdk/WasmApp.Common.targets(831,5): 
error MSB4018: The "EmccCompile" task failed unexpectedly. [/__w/macro-benchmarks/macro-benchmarks/src/micro-benchmarks/MicroBenchmarks.csproj]

Regression?

Net9
#104141

Known Workarounds

Configuration

github actions docker

Other information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions