Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SB version info for 8.0 Preview 2 release #15851

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

mthalman
Copy link
Member

Ports the changes to main that were mistakenly made to the release/8.0.1xx-preview2 branch in #15796.

@mthalman mthalman requested a review from a team as a code owner March 17, 2023 14:13
@mthalman mthalman requested a review from premun March 17, 2023 14:14
@premun
Copy link
Member

premun commented Mar 17, 2023

Thanks for porting this

@MichaelSimons MichaelSimons enabled auto-merge (squash) March 17, 2023 14:19
@mthalman
Copy link
Member Author

Aaaand, it's failing in runtime:

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

@MichaelSimons MichaelSimons merged commit ab62369 into dotnet:main Mar 17, 2023
@mthalman mthalman deleted the preview2-version-updates branch March 17, 2023 17:35
mthalman added a commit to mthalman/installer that referenced this pull request Mar 17, 2023
@mthalman
Copy link
Member Author

This change had to be reverted by #15856. It turns out the error I posted above is legitimate and happens sporadically. It got through the PR build in this way.

For context, this change is intended to update source-build to use the .NET 8 Preview 2 SDK to run the build with.

Here's what my investigation has uncovered so far:

There are two builds that I'm comparing the results of because there is a build leg that succeeds in one build and fails in the other even though they are based on the same changes. Possibly some race condition going on. Here are the binlogs (internal links):

The error is occurring when invoking the ilc tool. When looking at differences in the ILCompiler.csproj where the error occurs, I found this difference between the builds:

Passing build:
image

Failing build:
image

Clearly, the failing build is missing System.CommandLine.dll which is causing the error.

Looking further up the build for differences, I came to a difference in the output of the call to the ComputeManagedAssembliesToCompileToNative task that seems to directly determine which files are in context that get flowed to ilc. Between the two builds, the inputs are identical. But the outputs shows that _AssembliesToSkipPublish in the failing build is missing these files which are included in the output of the passing build:

  • /vmr/src/runtime/artifacts/source-build/self/package-cache/system.commandline/2.0.0-beta4.22622.1/lib/net7.0/System.CommandLine.dll
  • /vmr/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.Compiler/x64/Release/ILCompiler.Compiler.dll
  • /vmr/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.DependencyAnalysisFramework/x64/Release/ILCompiler.DependencyAnalysisFramework.dll
  • /vmr/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.MetadataTransform/x64/Release/ILCompiler.MetadataTransform.dll
  • /vmr/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.RyuJit/x64/Release/ILCompiler.RyuJit.dll
  • /vmr/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.TypeSystem/x64/Release/ILCompiler.TypeSystem.dll

There are a bunch of other files included in this list that are common between the two builds. But the files listed above are only included in the passing build and missing from the failing build. You can use this filter in the binlog viewer to find this task: $task ComputeManagedAssembliesToCompileToNative under(ILCompiler.csproj)

The logic for that task indicates that any failure to while reading/analyzing the file will result in it being excluded from the list of assemblies to skip publish. Given that any failure could occur for it to be excluded, it's hard to say what the actual cause is at this point. I don't yet have a local repro with files to examine.

Including some other people that may be able to help: @ViktorHofer, @mmitche, @MichalStrehovsky

@mthalman
Copy link
Member Author

mthalman commented Mar 20, 2023

In order to diagnose what's going on, I built my own custom version of the SDK with extra logging in the ComputeManagedAssembliesToCompileToNative task. It's throwing BadImageFormatException when attempting to get the metadata reader for the files that I enumerated in my previous post (System.CommandLine.dll, ILCompiler.Compiler.dll, etc). What's interesting is that it's outputting this when attempting to load the first of the files:

Assembly loaded during TaskRun (Build.Tasks.ComputeManagedAssembliesToCompileToNative): System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /repos/dotnet/src/runtime/artifacts/source-build/self/package-cache/microsoft.dotnet.ilcompiler/8.0.0-preview.2.23128.3/tools/netstandard/System.Collections.Immutable.dll, MVID: 0c714f67-69df-4f47-904e-73e0b98d3c44, AppDomain: [Default])

@mthalman
Copy link
Member Author

I've also created my own console app that replicates that the ComputeManagedAssembliesToCompileToNative task logic is doing. That runs fine. The BadImageFormatException doesn't get thrown. This is using the same SDK that source-build is using and targeting the same file DLL path that the actual build is using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants