Skip to content

Project doesn't build under .NET 11 due to ReadyToRun error #25867

Description

@jonpryor

Apple platform

iOS

Framework version

net11.0-*, net10.0-*

Affected platform version

.NET 11

Description

Project which builds under .NET 10 fails to build under .NET 11 Preview 5. This appears to be due to changing the runtime from MonoVM to CoreCLR, and running the new ReadyToRun infrastructure.

Steps to Reproduce

  1. Download and unzip: uno53net9blank.zip

  2. By default, it targets net10.0-ios. This builds:

    dotnet build -bl:net10.binlog uno53net9blank/uno53net9blank.csproj
    
  3. Build for net11.0-ios by overriding the $(TargetFrameworksOverride) MSBuild property:

    dotnet build -bl:net11.binlog uno53net9blank/uno53net9blank.csproj -p:TargetFrameworksOverride=net11.0-ios
    

(3) promptly fails:

Restore complete (0.4s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  uno53net9blank net11.0-ios iossimulator-arm64 failed with 14 error(s) and 1 warning(s) (15.0s) → uno53net9blank/bin/Debug/net11.0-ios/iossimulator-arm64/uno53net9blank.dll
    $HOME/Developer/tmp/_macios/uno53net9blank/uno53net9blank/ControlWithXamlEverywhereExceptDesktop.xaml.cs(11,11): warning Uno0006: Type 'uno53net9blank.ControlWithXamlEverywhereExceptDesktop' should call 'InitializeComponent()' from its constructor (https://aka.platform.uno/UNO0006)
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error Error: Failed to load assembly 'Microsoft.Extensions.Primitives'
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'Microsoft.Extensions.Primitives'
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID, String) in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 41
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at Internal.TypeSystem.ResolutionFailure.Throw() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Common/ResolutionFailure.cs:line 105
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.ReadyToRunVisibilityRootProvider.GetAllMethodImplRecordsForType(EcmaType) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunVisibilityRootProvider.cs:line 132
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.ReadyToRunVisibilityRootProvider.RootMethods(MetadataType, String, IRootingServiceProvider, Boolean) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunVisibilityRootProvider.cs:line 50
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.ReadyToRunVisibilityRootProvider.AddCompilationRoots(IRootingServiceProvider) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunVisibilityRootProvider.cs:line 39
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1, NodeFactory, IEnumerable`1, ILProvider, DevirtualizationManager, IEnumerable`1, Logger, InstructionSetSupport) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 68
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.ReadyToRunCodegenCompilation..ctor(DependencyAnalyzerBase`1, NodeFactory, IEnumerable`1, ILProvider, Logger, DevirtualizationManager, IEnumerable`1, String, InstructionSetSupport, Boolean, Boolean, Boolean, Boolean, Func`2, String, Boolean, String, Int32, Boolean, Int32, ProfileDataManager, MethodLayoutAlgorithm, FileLayoutAlgorithm, Int32, Boolean, ReadyToRunContainerFormat) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 358
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.ReadyToRunCodegenCompilationBuilder.ToCompilation() in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs:line 330
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,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 691
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.Program.Run() in /_/src/runtime/src/coreclr/tools/aot/crossgen2/Program.cs:line 314
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(515,5): error    at ILCompiler.Crossgen2RootCommand.<>c__DisplayClass223_0.<.ctor>b__0(ParseResult) in /_/src/runtime/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs:line 280
    $HOME/Downloads/dotnet-sdk-11.0.100-preview.5.26302.115/sdk/11.0.100-preview.5.26302.115/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(390,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false.

Build failed with 14 error(s) and 1 warning(s) in 15.6s

Of possible interest is that the net10 build has a message about that path:

Building target "_CopyResolvedFilesToPublishPreserveNewest" partially, because some output files are out of date with respect to their input files.
…
[_ResolvedFileToPublishPreserveNewest: Input=obj/Debug/net10.0-ios/iossimulator-arm64/linked/Microsoft.Extensions.Primitives.dll, Output=bin/Debug/net10.0-ios/iossimulator-arm64/publish/../uno53net9blank.app/Microsoft.Extensions.Primitives.dll] Output file does not exist.

Did you find any workaround?

No.

Build logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreCLRBugs related to our CoreCLR support

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions