title: PowerShell cannot find overload
body: <p>I'm attempting to use <a href="https://sshnet.codeplex.com/" rel="noreferrer">https://sshnet.codeplex.com/</a> to allow a PowerShell script to upload a file to a SFTP server. Everything appears to work, except it cannot find an overload of the method <code>UploadFile</code> and am stumped.</p>
  
  <p>The definition of the method is here</p>
  
  <pre><code>TypeName   : Renci.SshNet.SftpClient
  Name       : UploadFile
  MemberType : Method
  Definition : void UploadFile(System.IO.Stream input, string path, System.Action[uint64] uploadCallback),
               void UploadFile(System.IO.Stream input, string path, bool canOverride, System.Action[uint64] uploadCallback)
  </code></pre>
  
  <p>I'm trying to use this overload</p>
  
  <pre><code>UploadFile(System.IO.Stream input, string path, System.Action[uint64] uploadCallback)
  </code></pre>
  
  <p>The field <code>uploadCallback</code> is optional according to the documentation and isn't needed in my simple script, but even adding that in fails. The ways I've tried calling this with is as follows, they all fail.</p>
  
  <p>How do I successfully call one of these methods? Examples of what I tried are below.</p>
  
  <p><strong>Examples</strong></p>
  
  <pre><code>$client = New-Object Renci.SshNet.SftpClient($ftpHost, $ftpPort, $ftpUser, $ftpPass)
  $client.Connect()
  
  # ... get stream of file to upload here ...
  
  $client.UploadFile($sourceStream, "$ftpPath$output")
  </code></pre>
  
  <p>Fails with</p>
  
  <pre><code>Cannot find an overload for "UploadFile" and the argument count: "2".
  At F:\MyScript.ps1:170 char:2
  +     $client.UploadFile($sourceStream, "$ftpPath$output")
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodException
      + FullyQualifiedErrorId : MethodCountCouldNotFindBest
  </code></pre>
  
  <p>The next attempts all fail with the same error message essentially</p>
  
  <pre><code>$action = [System.Action[uint64]]
  $client.UploadFile($sourceStream, "$ftpPath$output", $action)
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Cannot find an overload for "UploadFile" and the argument count: "3".
  At F:\MyScript.ps1:170 char:2
  +     $client.UploadFile($sourceStream, "$ftpPath$output", $action)
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodException
      + FullyQualifiedErrorId : MethodCountCouldNotFindBest
  </code></pre>
  
  <p>Attempted with a <code>$null</code> 3rd parameter</p>
  
  <pre><code>$client.UploadFile($sourceStream, "$ftpPath$output", $null)
  </code></pre>
  
  <p>Failed with</p>
  
  <pre><code>Cannot find an overload for "UploadFile" and the argument count: "3".
  At F:\MyScript.ps1:169 char:2
  +     $client.UploadFile($sourceStream, "$ftpPath$output", $null)
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodException
      + FullyQualifiedErrorId : MethodCountCouldNotFindBest
  </code></pre>