scottwis / OpenFileOrFolderDialog

66 stars 43 forks source link

Navigating using the Libraries shortcut causes the dialog's Path property to fill with garbage #1

Open rossmurray opened 11 years ago

rossmurray commented 11 years ago

When using the OpenFileOrFolderDialog to choose a file or folder, if you navigate to any of the folders contained in the "Libraries" in Windows 7, the Path property will contain garbage.

Here's my code:

using (var dialog = new OpenFileOrFolderDialog())
{
    dialog.AcceptFiles = true;
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        textBox1.Text = dialog.Path;
    }
}

To reproduce, run the above code. Select "Libraries" on the left pane of the dialog. Then navigate to Documents (Music, Videos, etc. work as well). Highlight a subdirectory inside of Documents and press the Select button. The Path property will contain some garbage.

Example outputs:

޾拀޼
≐޾䬠޷怂麌곫
Ũ߁߂
Ⅰश㭸߀
摸߁�޿Volume{b3217025-7d33-11e0-895c-806e6f6e6963}\
岐࠭㰘࠷SERSPROFILE=C:\ProgramData

My project is .NET 4.0 and I'm using Visual Studio 2010. My OS is Windows 7 Professional 64-bit