Using SSH.NET; Method not found: 'Boolean System.Threading.WaitHandle.WaitOne(Int32)'.

I have downloaded this tool to run some SSH commands:
https://sshnet.codeplex.com/releases/view/120504

on my development machine, it works just fine:
Visual Studio 2008, Project Target Framework is 3.5
the referenced DLL is the 3.5 version, though in the "runtime version" value for it, i see v2.0.50727

on the production machine, the code fails in the .dll with the message in the title.

both machines have the following .NET frameworks installed:
v1.0.3705
v1.0.4322
v2.0.50727
v3.0
v3.5
v4.0.30319



the relevant part of the code couldn't be simpler:
using (Renci.SshNet.SshClient c = new SshClient(_host._host, _host._username, _host._password))
                    {
                        c.ErrorOccurred += new EventHandler<Renci.SshNet.Common.ExceptionEventArgs>(c_ErrorOccurred);
                        c.Connect();
                        if (c.IsConnected)
                        {
                            Renci.SshNet.SshCommand cmd = c.RunCommand(_request.command);
                            request.result_data = cmd.Result;

                            c.Disconnect();
...

Open in new window

what do I have to look at ?
LVL 143
Guy Hengel [angelIII / a3]Billing EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
I normally put usings at the top where they belong not inline

    
 static void Main(string[] args)
        {
            PasswordAuthenticationMethod authMethod = new PasswordAuthenticationMethod("debian", "temppwd");
            ConnectionInfo connectionInfo = new ConnectionInfo("192.168.1.42", "debian", authMethod);

            using (var ssh = new SshClient(connectionInfo))
            {
                ssh.Connect();
                while (true)
                {
                    string line = Console.ReadLine();
                    if (String.IsNullOrEmpty(line))
                    {
                        continue;
                    }

                    var cmd = ssh.CreateCommand(line);   //  very long list
                    var asynch = cmd.BeginExecute(delegate(IAsyncResult ar)
                    {
                        // Console.WriteLine("Finished.");
                    }, null);

                    var reader = new StreamReader(cmd.OutputStream);
                    while (!asynch.IsCompleted)
                    {
                        string result = reader.ReadLine();
                        if (!String.IsNullOrEmpty(result))
                        {
                            Console.WriteLine(result);
                        }
                    }

                    cmd.EndExecute(asynch);
                }
            }
https://sshnet.codeplex.com/discussions/548741
        }
    }

Open in new window

c = new SshClient(_host._host, _host._username, _host._password))  

Where did you get this idea of how to connect?
0
Guy Hengel [angelIII / a3]Billing EngineerAuthor Commented:
Hi,

  thanks for looking at my question, though your comment/suggestions are unfortunately off-topic...

  my code works on machine 1, but not on machine 2, so I need to know what I have to look in regards to configuration...

  your code is to implement a "full" interactive ssh tool, while my app is to run just 1 command  
  Async is not needed, and I want to avoid it actually, as it might end up in a "blocking" scenario where the loop doesn't end...
0
käµfm³d 👽Commented:
According to the documentation, the WaitOne method overload which takes an Int32 parameter didn't show up until .NET 3.5. It sounds like you project isn't be compiled to the correct Framework version.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Guy Hengel [angelIII / a3]Billing EngineerAuthor Commented:
I double-checked and ensure you that my project is compiled framework 3.5.
I went ahead and downloaded the source code, and tried to compile it in 3.5, and it failed, as some code require 4.0 framework, not sure how to proceed from there without going bad on the code and further versions.

I decided to check other SSH libraries...
0
Guy Hengel [angelIII / a3]Billing EngineerAuthor Commented:
for anyone interested, this link I found today indicates the underlying issue:
https://www.mikeplate.com/2008/09/26/missingmethodexception-and-waitone/
framework 3.5 was installed, yes, but the SP1 "missing".
once I installed that one, it was working fine on the offending machine
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.