MissingMethodException in Session.Open error in .NET Core 2.0

Advertisement

Alberto_Valentin
Joined:
Posts:
2
Location:
NJ

MissingMethodException in Session.Open error in .NET Core 2.0

While running this C# code (dotnet 2.0.3), the app throws System.MissingMethodException when I get to this line: session.Open(sessionOptions)
Using WinSCP 5.13.1.0
my code:
SessionOptions sessionOptions = new SessionOptions
{
  Protocol = WinSCP.Protocol.Sftp,
  HostName = "10.22.111.12",
  PortNumber = 22,
  UserName = "ec2-user", // this is on AWS.  linux EC2 instance 
  SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:..."
};
using (Session session = new Session())
{
  session.DebugLogPath = @"C:\Projects_c#\AWS\consoleApp\AMFConsoleApp\log.txt"; 
  session.Open(sessionOptions); // I get the error right here
  session.MoveFile(filePath, "10.22.111.12/appdata/content");
  session.Close();                      
}

See the log.txt attached
Description: session.DebugLogPath = @"C:\Projects_c#\AWS\consoleApp\AMFConsoleApp\log.txt";

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,692
Location:
Prague, Czechia

Re: .net core support

I'll look into it in few days. Once I have anything to test, I'll contact you.

Though note that there's no way to make the assembly working on other system than Windows.

Reply with quote

ZielinskiP
Joined:
Posts:
1
Location:
Polska

Re: .net core support

Could you please add me to acess of the developer version of WinSCP ?

I have the same problems with .Net Core 2

Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'.
at WinSCP.ExeSessionProcess.TryCreateEvent(String name, EventWaitHandle& ev)
at WinSCP.ExeSessionProcess.InitializeConsole()
at WinSCP.ExeSessionProcess.Start()
at WinSCP.Session.Open(SessionOptions sessionOptions)

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: .net core support

ZielinskiP wrote:

Could you please add me to acess of the developer version of WinSCP ?
Sent.

Reply with quote

croffers
Joined:
Posts:
1
Location:
United States

Downloaded 5.14.1 Beta still getting error

I Downloaded the 5.14.1 Beta and I'm still receiving this error:
Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'.
Was the right version of the dll included in the Beta download?

I'm using .net core 2.1

Thanks,
Craig

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
36,692
Location:
Prague, Czechia

Re: Downloaded 5.14.1 Beta still getting error

croffers wrote:

I Downloaded the 5.14.1 Beta and I'm still receiving this error:
Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'.
Was the right version of the dll included in the Beta download?

I'm using .net core 2.1

Thanks,
Craig
Download ".NET assembly" package:
https://winscp.net/eng/downloads.php

(Not the installer - which does not include .NET Standard build of the assembly)

Reply with quote

Pathrudu Majji
Guest

What is the solution ?

Hi Guys,

Finally what is the solution for this issue. I did not find anything from above discussion.

I had an Azure function which i am hosting in Azure. I installed WinSCP 5.13.8 from NuGet package manager. When I run this code in local, it is working fine. But this throwing above method not found error once I hosted the function and ran it from AZURE.

ERROR: System.MissingMethodException: Method not found: 'Void System.Threading.EventWaitHandle..ctor(Boolean, System.Threading.EventResetMode, System.String, Boolean ByRef, System.Security.AccessControl.EventWaitHandleSecurity)'.

Reply with quote

Advertisement

Pathrudu Majji
Guest

Re: What is the solution ?

sorry for the confusion. It is not working in my local too. Do i need to add any packages? Please help me out

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
36,692
Location:
Prague, Czechia

Re: What is the solution ?

Pathrudu Majji wrote:

I had an Azure function which i am hosting in Azure. I installed WinSCP 5.13.8 from NuGet package manager. When I run this code in local, it is working fine. But this throwing above method not found error once I hosted the function and ran it from AZURE.
You have to download WinSCP 5.14 RC for .NET Core support.

For information about using the assembly in Azure Function, see also: https://winscp.net/eng/docs/guide_microsoft_azure_function_sftp

Reply with quote

Advertisement

You can post new topics in this forum