[AMD64 Unix ELT] CoreCLR script 'runtest' gets 'System.TypeInitializationException' with COMPlus_JitELTHookEnabled=1
[CoreCLR script 'runtest' gets 'System.TypeInitializationException' on Ubuntu x64 with the environment variable COMPlus_JitELTHookEnabled=1
The message is
Running init-tools.sh
Tools are already initialized
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.InternalAbstractions.RuntimeEnvironment' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.InternalAbstractions.Native.PlatformApis' threw an exception. ---> System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Lazy`1..ctor(Func`1 valueFactory)
at Microsoft.DotNet.InternalAbstractions.Native.PlatformApis..cctor()
--- End of inner exception stack trace ---
at Microsoft.DotNet.InternalAbstractions.RuntimeEnvironment..cctor()
--- End of inner exception stack trace ---
at Microsoft.DotNet.InternalAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
at Microsoft.DotNet.Cli.MulticoreJitProfilePathCalculator.CalculateProfileRootPath()
at Microsoft.DotNet.Cli.MulticoreJitActivator.StartCliProfileOptimization()
at Microsoft.DotNet.Cli.MulticoreJitActivator.TryActivateMulticoreJit()
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Failed to query runtime Id
both on Debug and Checked builds.
The used command line is
$ coreclr/tests/runtest.sh --testRootDir=~/coreclr/Tests --testNativeBinDir="./coreclr/bin/obj/Linux.x64.Checked/tests" --coreClrBinDir="./coreclr/bin/Product/Linux.x64.Checked" --coreFxBinDir="~/corefx/bin/runtime/netcoreapp-Linux-Debug-x64"
The used versions are of coreclr 25169926291fcdcad25506c558690a0f63e61a93 Move files to shared CoreLib partition (#10837) of corefx 39ca7d8683aa369f2b9ce8e95be50fda2d1011d9 Update ProjectNTfs, ProjectNTfsTestILC to beta-25210-00, beta-25210-00, respectively (#18131) test binaries - Artifacts of debug_windows_nt 1416
CC: @Dmitri-Botcharnikov @kvochko @janvorli @noahfalk
dotnet/coreclr#7719
dotnet/runtime#7825
dotnet/runtime#7306
https://github.com/dotnet/coreclr/pull/12603
The latest version of CoreCLR doesn't show this issue