Skip to content

.NET 11 preview-7: Crossgen fails when building PowerShell on Linux and macOS #55762

Description

@daxian-dbw

Describe the bug

We moved PowerShell to use the latest .NET SDK 11.0.100-preview.7 and that broke the PowerShell build on Linux and macOS. Build on Windows is fine.

Here are the CI runs
Linux -- Ubuntu 24.04: 27828/merge - 6179 · PowerShell/PowerShell@623e11d
macOS -- 15.7.7: 27828/merge - 6136 · PowerShell/PowerShell@623e11d

The build failure output:

    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error : Error: Failed to load assembly 'System.Formats.Nrbf' [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error : Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'System.Formats.Nrbf' [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID, String) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 41 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.ResolutionFailure.Throw() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Common/ResolutionFailure.cs:line 105 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle, NotFoundBehavior) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaModule.cs:line 527 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaSignatureParser.ResolveHandle(EntityHandle) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs:line 61 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseTypeImpl(SignatureTypeCode) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs:line 256 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseMethodSignatureImpl(Boolean) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs:line 403 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseMethodSignature() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs:line 337 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at Internal.TypeSystem.Ecma.EcmaMethod.InitializeSignature() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaMethod.cs:line 88 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.InheritedVirtualMethodsNode.GetConditionalStaticDependencies(NodeFactory) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/InheritedVirtualMethodsNode.cs:line 91 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 194 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 261 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 309 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.ReadyToRunCodegenCompilation.Compile(String) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 402 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.Program.RunSingleCompilation(Dictionary`2, InstructionSetSupport, String, Dictionary`2, HashSet`1, ReadyToRunCompilerContext, Logger) in /_/src/runtime/src/coreclr/tools/aot/crossgen2/Program.cs:line 693 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.Program.Run() in /_/src/runtime/src/coreclr/tools/aot/crossgen2/Program.cs:line 314 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]
    /usr/share/dotnet/sdk/11.0.100-preview.7.26381.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(501,5): error :    at ILCompiler.Crossgen2RootCommand.<>c__DisplayClass216_0.<.ctor>b__0(ParseResult) in /_/src/runtime/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs:line 275 [/home/runner/work/PowerShell/PowerShell/src/powershell-unix/powershell-unix.csproj]

Steps to reproduce

Building PowerShell on Linux (e.g. Ubuntu 24.04) and macOS (e.g. 15.7.7).
The _CreateR2RImages step will take forever and eventually timed out (cancelled by ctrl+c) with the error output shared above.

Image

Expected behavior

PowerShell build successfully with the _CreateR2RImages step finishes within 30 seconds or so. That's the behavior before us moving to .NET 11 preview.7.

Actual behavior

_CreateR2RImages takes forever and eventually fails.

Is this a regression?

Yes, a regression to .NET 11 preview.6 and prior versions of SDK.

Are there any workarounds?

No.

dotnet --info output

PS /home/daxian/repos/PowerShell> dotnet --info
.NET SDK:
 Version:           11.0.100-preview.7.26381.103
 Commit:            e2c1e00b3d
 Workload version:  11.0.100-manifests.2ce71a7f
 MSBuild version:   18.10.0-1.26381.103+e2c1e00b3

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/daxian/.dotnet/sdk/11.0.100-preview.7.26381.103/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
  Version:      11.0.0-preview.7.26381.103
  Architecture: x64
  Commit:       e2c1e00b3d

.NET SDKs installed:
  11.0.100-preview.7.26381.103 [/home/daxian/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 11.0.0-preview.7.26381.103 [/home/daxian/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 11.0.0-preview.7.26381.103 [/home/daxian/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  /home/daxian/repos/PowerShell/global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

IDE version

No response

Other details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions