ikvm
ikvm copied to clipboard
Type Initialization Error on .NET Framework 4.8.1
Stack Trace
System.TypeInitializationException: Der Typeninitialisierer für "org.apache.sshd.server.ServerBuilder" hat eine Ausnahme verursacht..
Stack Trace:
at java.lang.invoke.MethodHandleImpl.BindCaller.checkCallerClass(Class expected, Class expected2, CallerID )
at PairwiseConvert(Object[] , Object , Object , Object )
at java.lang.invoke.MethodHandleImpl.BindCaller.makeInjectedInvoker(Class hostClass)
--- Ende der internen Ausnahmestapelüberwachung ---
at java.lang.invoke.MethodHandleImpl.BindCaller.makeInjectedInvoker(Class hostClass)
at java.lang.invoke.MethodHandleImpl.BindCaller.access$300(Class x0)
at java.lang.invoke.MethodHandleImpl.BindCaller.1.computeValue(Class hostClass)
at java.lang.invoke.MethodHandleImpl.BindCaller.1.computeValue(Class hostClass)
at java.lang.ClassValue.getFromHashMap(Class type)
at java.lang.ClassValue.getFromBackup(Entry[] cache, Class type)
at java.lang.ClassValue.get(Class type)
at java.lang.invoke.MethodHandleImpl.BindCaller.bindCaller(MethodHandle mh, Class hostClass)
at java.lang.invoke.MethodHandleImpl.bindCaller(MethodHandle mh, Class hostClass)
at java.lang.invoke.MethodHandles.Lookup.maybeBindCaller(MemberName method, MethodHandle mh, Class callerClass)
at java.lang.invoke.MethodHandles.Lookup.getDirectMethodCommon(Byte refKind, Class refc, MemberName method, Boolean checkSecurity, Boolean doRestrict, Class callerClass)
at java.lang.invoke.MethodHandles.Lookup.getDirectMethodNoSecurityManager(Byte refKind, Class refc, MemberName method, Class callerClass)
at java.lang.invoke.MethodHandles.Lookup.getDirectMethodForConstant(Byte refKind, Class defc, MemberName member)
at java.lang.invoke.MethodHandles.Lookup.linkMethodHandleConstant(Byte refKind, Class defc, String name, Object type)
at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(Class callerClass, Int32 refKind, Class defc, String name, Object type)
at IKVM.Runtime.ByteCodeHelper.DynamicLoadMethodHandleImpl(Int32 kind, String clazz, String name, String sig, CallerID callerID)
at IKVM.Runtime.ByteCodeHelper.DynamicLoadMethodHandle(MethodHandle& cache, Int32 kind, String clazz, String name, String sig, CallerID callerID)
at org.apache.sshd.common.util.threads.ThreadUtils.1.__<>IndyCS1.BootstrapStub(Class )
at org.apache.sshd.common.util.threads.ThreadUtils.1..ctor(Class c) in ThreadUtils.java:Zeile 241.
at org.apache.sshd.common.util.threads.ThreadUtils.iterateDefaultClassLoaders(Class anchor) in ThreadUtils.java:Zeile 234.
at org.apache.sshd.common.util.threads.ThreadUtils.lambda$resolveDefaultClassLoaders$0(Class anchor) in ThreadUtils.java:Zeile 140.
at org.apache.sshd.common.util.threads.ThreadUtils.__<>Anon0.iterator()
at org.apache.sshd.common.util.threads.ThreadUtils.createDefaultInstance(Iterable cls, Class targetType, String className) in ThreadUtils.java:Zeile 174.
at org.apache.sshd.common.util.threads.ThreadUtils.createDefaultInstance(Class anchor, Class targetType, String className) in ThreadUtils.java:Zeile 161.
at org.apache.sshd.common.util.security.SecurityUtils.register() in SecurityUtils.java:Zeile 431.
at org.apache.sshd.common.util.security.SecurityUtils.createSecurityEntityFactory(Class entityType, Predicate entitySelector) in SecurityUtils.java:Zeile 726.
at org.apache.sshd.common.util.security.SecurityUtils.lambda$resolveSecurityEntityFactory$1(Class entityType, Predicate entitySelector, String k) in SecurityUtils.java:Zeile 715.
at org.apache.sshd.common.util.security.SecurityUtils.__<>Anon1.apply(Object )
at java.util.Map.<default>computeIfAbsent(Map , Object , Function )
at java.util.TreeMap.computeIfAbsent(Object , Function )
at org.apache.sshd.common.util.security.SecurityUtils.resolveSecurityEntityFactory(Class entityType, String algorithm, Predicate entitySelector) in SecurityUtils.java:Zeile 714.
at org.apache.sshd.common.util.security.SecurityUtils.getMessageDigest(String algorithm) in SecurityUtils.java:Zeile 759.
at org.apache.sshd.common.digest.DigestUtils.checkSupported(String algorithm) in DigestUtils.java:Zeile 54.
at org.apache.sshd.common.digest.BuiltinDigests..ctor(String str, Int32 i, String factoryName, String algorithm, Int32 blockSize) in BuiltinDigests.java:Zeile 59.
at org.apache.sshd.common.digest.BuiltinDigests..cctor() in BuiltinDigests.java:Zeile 36.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.common.cipher.ECCurves..cctor() in ECCurves.java:Zeile 62.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.common.keyprovider.KeyPairProvider..cctor() in KeyPairProvider.java:Zeile 63.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.common.signature.BuiltinSignatures..cctor() in BuiltinSignatures.java:Zeile 155.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.common.BaseBuilder..cctor() in BaseBuilder.java:Zeile 123.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.common.BaseBuilder.__<clinit>()
at org.apache.sshd.server.ServerBuilder..cctor() in ServerBuilder.java:Zeile 60.
--- Ende der internen Ausnahmestapelüberwachung ---
at org.apache.sshd.server.ServerBuilder.builder()
at org.apache.sshd.server.SshServer.setUpDefaultServer() in SshServer.java:Zeile 441.
at test.EmbeddedSftpServer.start(Local directory)
at test.EmbeddedSftpServer.start()
at Test.StartEmbeddedSftpServer()
at Test.StartEmbeddedServers()
at Test.ClassSetup(TestContext testContext)
Stack Trace (Repro, .NET 6)
Unhandled exception. System.TypeInitializationException: The type initializer for 'org.apache.sshd.server.ServerBuilder' threw an exception.
---> System.TypeInitializationException: The type initializer for 'org.apache.sshd.common.BaseBuilder' threw an exception.
---> System.TypeInitializationException: The type initializer for 'org.apache.sshd.common.signature.BuiltinSignatures' threw an exception.
---> System.TypeInitializationException: The type initializer for 'org.apache.sshd.common.keyprovider.KeyPairProvider' threw an exception.
---> System.TypeInitializationException: The type initializer for 'org.apache.sshd.common.cipher.ECCurves' threw an exception.
---> System.TypeInitializationException: The type initializer for 'org.apache.sshd.common.digest.BuiltinDigests' threw an exception.
---> java.lang.InternalError: java.lang.InternalError: found java.lang.invoke.MethodHandleImpl$BindCaller, expected org.apache.sshd.common.util.threads.ThreadUtils$1, or else java.lang.invoke.MethodHandleImpl$BindCaller$T/54875957
--- End of inner exception stack trace ---
at org.apache.sshd.common.cipher.ECCurves..cctor()
--- End of inner exception stack trace ---
at org.apache.sshd.common.keyprovider.KeyPairProvider..cctor()
--- End of inner exception stack trace ---
at org.apache.sshd.common.signature.BuiltinSignatures..cctor()
--- End of inner exception stack trace ---
at org.apache.sshd.common.signature.BuiltinSignatures.get_nistp256_cert()
at org.apache.sshd.common.BaseBuilder..cctor()
--- End of inner exception stack trace ---
at org.apache.sshd.common.BaseBuilder.__<clinit>()
at org.apache.sshd.server.ServerBuilder..cctor()
--- End of inner exception stack trace ---
at org.apache.sshd.server.ServerBuilder.builder()
at org.apache.sshd.server.SshServer.setUpDefaultServer()
at Program.<Main>$(String[] args) in c:\Users\user\Desktop\ikvm-test\Program.cs:line 4
Related Java code: apache mina-sshd/SecurityUtils.java
Repro: ikvm-test.zip
dotnet --info
.NET SDK:
Version: 8.0.204
Commit: c338c7548c
Workload version: 8.0.200-manifests.7d36c14f
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.204\
Installierte .NET-Workloads:
Es sind keine installierten Workloads zum Anzeigen vorhanden.
Host:
Version: 8.0.4
Architecture: x64
Commit: 2d7eea2529
.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.321 [C:\Program Files\dotnet\sdk]
8.0.204 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The repro seems to run for me.
Interesting, that exact repro fails for me - not just a one-off situation. Difference would be de-DE/en-US locale.
Will check on an english system whether that's failing there as well.
On a fresh Windows 11 22631.3447, with .NET 6 runtime installed from Visual Studio Installer, using an en-US image, I still encounter the type initialization error.
Repro in https://github.com/ikvmnet/ikvm/tree/bugfix/509