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

Stop referencing S.R.Metadata directly #107343

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

MichalStrehovsky
Copy link
Member

Should fix #106983.

This was added in #101666 to address a point in time issue. It should not be needed anymore.

@dotnet/ilc-contrib or @dotnet/crossgen-contrib for review

This was added in dotnet#101666 to address a point in time issue. It should not be needed anymore.
@ivdiazsa
Copy link
Member

ivdiazsa commented Sep 4, 2024

There seems to be a NullReferenceException in the ILC when building some tests on Windows. Could it be related to the removal of the System.Reflection.Metadata package reference?

2024-09-04T10:41:12.4500022Z     ReferencedAssembly1 -> D:\a\_work\1\s\artifacts\tests\coreclr\windows.x64.Checked\nativeaot\GenerateUnmanagedEntryPoints\ReferencedAssembly1\ReferencedAssembly1\ReferencedAssembly1.dll
2024-09-04T10:41:13.1656360Z     Library -> D:\a\_work\1\s\artifacts\tests\coreclr\windows.x64.Checked\nativeaot\SmokeTests\TrimmingBehaviors\Library\Library.dll
2024-09-04T10:41:15.0059947Z     UnitTests -> D:\a\_work\1\s\artifacts\tests\coreclr\windows.x64.Checked\nativeaot\SmokeTests\UnitTests\UnitTests\UnitTests.dll
2024-09-04T10:41:15.1380932Z     Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
2024-09-04T10:41:15.1584707Z     Generating native code
2024-09-04T10:41:15.1717468Z     Unhandled exception: System.AggregateException: One or more errors occurred. (Code generation failed for method '[S.P.StackTraceMetadata]Internal.Runtime.CompilerHelpers.LibraryInitializer.InitializeLibrary()')
2024-09-04T10:41:15.2279923Z      ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.StackTraceMetadata]Internal.Runtime.CompilerHelpers.LibraryInitializer.InitializeLibrary()'
2024-09-04T10:41:15.2313600Z      ---> ILCompiler.NativeAotFatalErrorException: ILC: error IL1013: Error processing 'name'.
2024-09-04T10:41:15.2348819Z      ---> System.NullReferenceException: Object reference not set to an instance of an object.
2024-09-04T10:41:15.2382749Z        at System.Xml.XPath.XNodeNavigator.MoveToFirstChild() + 0x22
2024-09-04T10:41:15.2425571Z        at MS.Internal.Xml.XPath.XPathChildIterator.MoveNext() + 0x19
2024-09-04T10:41:15.2505918Z        at System.Xml.XPath.XPathNodeIterator.Enumerator.MoveNext() + 0xd6
2024-09-04T10:41:15.2529738Z        at ILCompiler.ProcessLinkerXmlBase.ProcessAssemblies(XPathNavigator) + 0x157
2024-09-04T10:41:15.2554386Z        at ILCompiler.ProcessLinkerXmlBase.ProcessXml(Boolean) + 0xfa
2024-09-04T10:41:15.2565791Z        --- End of inner exception stack trace ---
2024-09-04T10:41:15.2573349Z        at ILCompiler.ProcessLinkerXmlBase.ProcessXml(Boolean) + 0x1d9
2024-09-04T10:41:15.2581448Z        at ILCompiler.SubstitutionProvider.AssemblyFeatureInfo..ctor(EcmaModule, Logger, IReadOnlyDictionary`2, BodyAndFieldSubstitutions) + 0x1ce
2024-09-04T10:41:15.2589007Z        at ILCompiler.SubstitutionProvider.FeatureSwitchHashtable.CreateValueFromKey(EcmaModule) + 0x4e
2024-09-04T10:41:15.2596514Z        at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x18
2024-09-04T10:41:15.2604027Z        at ILCompiler.SubstitutionProvider.GetSubstitution(MethodDesc) + 0x77
2024-09-04T10:41:15.2611273Z        at ILCompiler.SubstitutedILProvider.GetMethodIL(MethodDesc) + 0x1b
2024-09-04T10:41:15.2618573Z        at ILCompiler.Compilation.CombinedILProvider.GetMethodIL(MethodDesc) + 0x21
2024-09-04T10:41:15.2626089Z        at ILCompiler.Compilation.ILCache.CreateValueFromKey(MethodDesc) + 0x3c
2024-09-04T10:41:15.2633464Z        at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x18
2024-09-04T10:41:15.2645207Z        at ILCompiler.Compilation.GetMethodIL(MethodDesc) + 0x8d
2024-09-04T10:41:15.2652505Z        at Internal.IL.ILImporter..ctor(ILScanner, MethodDesc, MethodIL) + 0x55
2024-09-04T10:41:15.2659871Z        at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode) + 0x57
2024-09-04T10:41:15.2667980Z        --- End of inner exception stack trace ---
2024-09-04T10:41:15.2675293Z        at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode) + 0x22b
2024-09-04T10:41:15.2682652Z        at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker&, Int64, Boolean&) + 0x10d
2024-09-04T10:41:15.2690095Z     --- End of stack trace from previous location ---
2024-09-04T10:41:15.2697399Z        at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker&, Int64, Boolean&) + 0x4e4
2024-09-04T10:41:15.2704727Z        at System.Threading.Tasks.TaskReplicator.Replica.Execute() + 0xb1
2024-09-04T10:41:15.2710105Z        --- End of inner exception stack trace ---
2024-09-04T10:41:15.2715152Z        at System.Threading.Tasks.TaskReplicator.Run[TState](TaskReplicator.ReplicatableUserAction`1, ParallelOptions, Boolean) + 0x2b2
2024-09-04T10:41:15.2720121Z        at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x21f
2024-09-04T10:41:15.2736251Z     --- End of stack trace from previous location ---
2024-09-04T10:41:15.2835851Z        at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection, CancellationToken, Exception) + 0x30
2024-09-04T10:41:15.2861426Z        at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x449
2024-09-04T10:41:15.2892038Z        at ILCompiler.ILScanner.CompileMultiThreaded(List`1) + 0x264
2024-09-04T10:41:15.2914077Z        at ILCompiler.ILScanner.ComputeDependencyNodeDependencies(List`1) + 0x153
2024-09-04T10:41:15.2955131Z        at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x159
2024-09-04T10:41:15.2982191Z        at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x1b
2024-09-04T10:41:15.3037341Z        at ILCompiler.Program.<Run>g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x1fd
2024-09-04T10:41:15.3060944Z        at ILCompiler.Program.Run() + 0x26e6
2024-09-04T10:41:15.3074210Z        at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321
2024-09-04T10:41:15.3088338Z        at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult) + 0x6f
2024-09-04T10:41:15.3108483Z D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Checked\build\Microsoft.NETCore.Native.targets(317,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Checked\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\tests\coreclr/obj/windows.x64.Checked/Managed/nativeaot\SmokeTests\UnitTests\UnitTests\native\UnitTests.ilc.rsp"" exited with code 1. [D:\a\_work\1\s\src\tests\nativeaot\SmokeTests\UnitTests\UnitTests.csproj] [D:\a\_work\1\s\src\tests\build.proj]
2024-09-04T10:41:15.3126276Z ##[error]artifacts\bin\coreclr\windows.x64.Checked\build\Microsoft.NETCore.Native.targets(317,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Checked\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\tests\coreclr/obj/windows.x64.Checked/Managed/nativeaot\SmokeTests\UnitTests\UnitTests\native\UnitTests.ilc.rsp"" exited with code 1. 

@MichalStrehovsky
Copy link
Member Author

There seems to be a NullReferenceException in the ILC when building some tests on Windows. Could it be related to the removal of the System.Reflection.Metadata package reference?

It disappeared on rerun. I've not seen this before. Could be something like #104340. We've not been able to pick up a fix for that yet (requires an update from dotnet/runtime in this repo that we cannot pick up due to the issue I'm fixing here).

@MichalStrehovsky MichalStrehovsky merged commit 19942d9 into dotnet:main Sep 4, 2024
88 checks passed
@MichalStrehovsky MichalStrehovsky deleted the fix106983 branch September 4, 2024 20:43
@MichalStrehovsky MichalStrehovsky restored the fix106983 branch September 4, 2024 21:25
@MichalStrehovsky MichalStrehovsky deleted the fix106983 branch September 4, 2024 21:26
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Sep 6, 2024
This was added in dotnet#101666 to address a point in time issue. It should not be needed anymore.
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
This was added in dotnet#101666 to address a point in time issue. It should not be needed anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet-pgo used in build with new packages without ensuring matching framework
4 participants