Description
openedon Mar 20, 2023
The changes in #81205 have caused a failure when attempting to use .NET 8 Preview 2 SDK to build the Preview 3 source. This is a required scenario for .NET's Source-Build. This was identified in the changes to update the source-build configuration so that it references the Preview 2 SDK: dotnet/installer#15851.
The error that occurs is for the ILCompiler project:
EXEC : error : Failed to load assembly 'System.CommandLine' [/vmr/src/runtime/artifacts/source-build/self/src/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]
Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'System.CommandLine'
at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 35
at Internal.TypeSystem.ResolutionFailure.Throw() in /_/src/coreclr/tools/Common/TypeSystem/Common/ResolutionFailure.cs:line 105
at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle, NotFoundBehavior ) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaModule.cs:line 412
at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaModule.cs:line 359
at Internal.TypeSystem.Ecma.EcmaType.InitializeBaseType() in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs:line 163
at Internal.TypeSystem.Ecma.EcmaType.ComputeTypeFlags(TypeFlags) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs:line 199
at Internal.TypeSystem.TypeDesc.InitializeTypeFlags(TypeFlags) in /_/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs:line 135
at Internal.TypeSystem.Ecma.EcmaType.ComputeTypeFlags(TypeFlags) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs:line 247
at Internal.TypeSystem.TypeDesc.InitializeTypeFlags(TypeFlags) in /_/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs:line 135
at Internal.TypeSystem.MetadataFieldLayoutAlgorithm.ComputeInstanceLayout(DefType, InstanceLayoutKind) in /_/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs:line 41
at Internal.TypeSystem.DefType.ComputeInstanceLayout(InstanceLayoutKind) in /_/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs:line 436
at ILCompiler.CompilerTypeSystemContext.EnsureLoadableTypeUncached(TypeDesc) in /_/src/coreclr/tools/Common/Compiler/CompilerTypeSystemContext.Validation.cs:line 137
at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs:line 562
at ILCompiler.DependencyAnalysis.EETypeNode..ctor(NodeFactory, TypeDesc) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs:line 85
at ILCompiler.DependencyAnalysis.NodeFactory.CreateConstructedTypeNode(TypeDesc) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs:line 542
at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs:line 562
at ILCompiler.DependencyAnalysis.NodeFactory.ConstructedTypeSymbol(TypeDesc) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs:line 614
at ILCompiler.DependencyAnalysis.ReflectionInvokeMapNode.AddDependenciesDueToReflectability(DependencyList&, NodeFactory, MethodDesc) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs:line 54
at ILCompiler.MetadataManager.GetDependenciesDueToReflectability(DependencyList&, NodeFactory, MethodDesc) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MetadataManager.cs:line 399
at ILCompiler.DependencyAnalysis.ReflectedMethodNode.GetStaticDependencies(NodeFactory) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectedMethodNode.cs:line 39
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 182
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 222
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 257
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 308
at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs:line 140
at ILCompiler.Program.<Run>g__RunScanner|3_0(<>c__DisplayClass3_0&) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 438
at ILCompiler.Program.Run() in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 418
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass203_0.<.ctor>b__0(InvocationContext) in /_/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs:line 272
An analysis of the error and its symptoms is given here: dotnet/installer#15851 (comment). As stated in the analysis, the behavior is sporadic for some reason. One notable symptom is that BadImageFormatException
is thrown when attempting to load certain assemblies in the ComputeManagedAssembliesToCompileToNative
build task.
It's been confirmed that reverting the changes in #81205 resolves the issue. We should consider reverting this change or getting a fix in to address this in the Preview 3 timeframe.