OpenFileOrFolderDialog icon indicating copy to clipboard operation
OpenFileOrFolderDialog copied to clipboard

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

Open rossmurray opened this issue 12 years ago • 0 comments

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

rossmurray avatar Apr 09 '13 22:04 rossmurray