title: SaveFileDialog exception in my WPF app
body: <p>One of my customers is experiencing a crash in my WPF application when saving a file.</p>
  
  <p>My save file code is:</p>
  
  <pre><code>var saveFileDialog = new SaveFileDialog {
    InitialDirectory = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"\MyApp"),
    FileName = "MyFile", 
    OverwritePrompt = true,
    AddExtension = true
  };
  
  if (saveFileDialog.ShowDialog() == true) {
    ...
  }
  </code></pre>
  
  <p>And here is the exception they are getting:</p>
  
  <pre><code>Value does not fall within the expected range.
  
  A System.ArgumentException occurred
     at MS.Internal.Interop.HRESULT.ThrowIfFailed(String message)
     at MS.Internal.AppModel.ShellUtil.GetShellItemForPath(String path)
     at Microsoft.Win32.FileDialog.PrepareVistaDialog(IFileDialog dialog)
     at Microsoft.Win32.FileDialog.RunVistaDialog(IntPtr hwndOwner)
     at Microsoft.Win32.FileDialog.RunDialog(IntPtr hwndOwner)
     at Microsoft.Win32.CommonDialog.ShowDialog()
  </code></pre>
  
  <p>(Where the <code>ShowDialog</code> in the last line refers to the call I make in my code above.)</p>
  
  <p>So my hunch is that in my customer's case, the call to Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) is returning something that the <code>SaveFileDialog</code> does not like as the <code>InitialDirectory</code>. I've found in web searches (and validated) that this error occurs when passing a relative path as the <code>InitialDirectory</code> of the SaveFileDialog. Is it possible that <code>Environment.SpecialFolder.MyDocuments</code> could be returned as a relative path? If not, does anybody know another potentially invalid format? Could a certain SpecialFolder.MyDocuments network path be the cause? Any other ideas?</p>
  
  <p>I don't have direct access to my customer's machine and they aren't particularly tech savvy so it's not possible to be 100% certain what is happening.</p>