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

Posted on 2014-08-28
Last Modified: 2016-09-27
I have downloaded this tool to run some SSH commands:

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:

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);
                        if (c.IsConnected)
                            Renci.SshNet.SshCommand cmd = c.RunCommand(_request.command);
                            request.result_data = cmd.Result;


Open in new window

what do I have to look at ?
    LVL 77

    Expert Comment

    by:David Johnson, CD, MVP
    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("", "debian", authMethod);
                using (var ssh = new SshClient(connectionInfo))
                    while (true)
                        string line = Console.ReadLine();
                        if (String.IsNullOrEmpty(line))
                        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))

    Open in new window

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

    Where did you get this idea of how to connect?
    LVL 142

    Author Comment

    by:Guy Hengel [angelIII / a3]

      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...
    LVL 74

    Accepted Solution

    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.
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    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...
    LVL 142

    Author Comment

    by:Guy Hengel [angelIII / a3]
    for anyone interested, this link I found today indicates the underlying issue:
    framework 3.5 was installed, yes, but the SP1 "missing".
    once I installed that one, it was working fine on the offending machine

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now