Session.Open() fails in PowerShell 7.0.0-preview.5 with Method not found: EventWaitHandle
Using WinSCP 5.15.5 on Windows 10 x64 Enterprise en-us 18363.449 the code:
That works in PowerShell 5. But does give the the following error in PowerShell 7 Preview 5 when calling the
The corresponding C# code does work on .NET Core 3.0.
Of cause I have no idea if the issue is on the PowerShell or WinSCP side.
I have just the feeling it would be easier to start here.
# Load WinSCP .NET assembly Add-Type -Path "WinSCPnet.dll" # Set up session options $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::Sftp HostName = "hostname.tld" UserName = "uid" SshHostKeyFingerprint = "ssh-ed25519 256 XXX=" SshPrivateKeyPath = "path.ppk" } $sessionOptions.AddRawSettings("Compression", "1") $sessionOptions.AddRawSettings("Cipher", "aes,blowfish,chacha20,WARN,3des,des,arcfour") $sessionOptions.AddRawSettings("KEX", "ecdh,dh-group14-sha1,rsa,WARN,dh-gex-sha1,dh-group1-sha1") $session = New-Object WinSCP.Session $session.SessionLogPath = "d:\temp\erg.log" try { # Connect $session.Open($sessionOptions) # Your code } finally { $session.Dispose() }
$session.Open()
:
No log file is created.MethodInvocationException: Exception calling "Open" with "1" argument(s): "Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'."
The corresponding C# code does work on .NET Core 3.0.
Of cause I have no idea if the issue is on the PowerShell or WinSCP side.
I have just the feeling it would be easier to start here.