title: InvokeMember give a different result than direct call
body: <p>I'm calling Shell.BrowseForFolder in VB.NET because I need to pass an arbitrary path in the rootFolder argument. So I instanciate an objet like this:</p>
  
  <pre><code>Dim shellType As Type = Type.GetTypeFromProgID("Shell.Application")
  Dim shell = Activator.CreateInstance(shellType)
  </code></pre>
  
  <p>Then I call:</p>
  
  <pre><code>Dim folder = shell.BrowseForFolder(0, message, &amp;H241, rootFolder)
  </code></pre>
  
  <p>It does not work as expected (the root folder F: is not used)</p>
  
  <p><img src="https://i.stack.imgur.com/BkbCM.png" alt="Direct call"></p>
  
  <p>But if I use reflection with the same arguments:</p>
  
  <pre><code>Dim folder = shellType.InvokeMember("BrowseForFolder", _
    BindingFlags.InvokeMethod, Nothing, shell, New Object() {0, message, &amp;H241, _
    rootFolder})
  </code></pre>
  
  <p>It works!</p>
  
  <p><img src="https://i.stack.imgur.com/hOP4G.png" alt="Reflection"></p>
  
  <p>But for me the 2 calls (InvokeMember and direct call) should produce similar results (the arguments are identical). What's happening?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In fact, it works if I call ToString() or if I put a litteral:</p>
  
  <pre><code>Dim folder = shell.BrowseForFolder(0, message, &amp;H241, rootFolder.ToString())
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Dim folder = shell.BrowseForFolder(0, message, &amp;H241, "F:")
  </code></pre>
  
  <p>But it doesn't work if rootFolder is an argument, eg:</p>
  
  <pre><code>Function BrowseForFolder(ByVal message As String, ByVal rootFolder As String) As String
      Dim shellType As Type = Type.GetTypeFromProgID("Shell.Application")
      Dim shell = Activator.CreateInstance(shellType)
      Dim folder = shell.BrowseForFolder(0, message, &amp;H241, rootFolder)
      If folder Is Nothing Then
          Return ""
      End If
      Return folder.Self.Path
  End Function
  </code></pre>