ookii-dialogs-wpf
ookii-dialogs-wpf copied to clipboard
Crash for SaveFileDialog when using root directory
- Bug crash of VistaFolderBrowserDialog when using root directory path (same for VistaSaveFileDialog when directory is "L:\" (not exist) and default file name is empty)
Hi @zappu9x, thanks for reporting this and for taking the time to submit PR #10.
Could you please add here the steps to reproduce this crash, screenshot, error message (if any), as well more details of your environment (OS, .NET version, NuGet package version, etc.)?
I tested VistaFolderBrowserDialog
, VistaSaveFileDialog
, and VistaOpenFileDialog
, by setting the initial directory to C:\
(also tested C:
) and default file name to empty
(and null
), and didn't see any crash.
Tested on Windows 10, .NET 4.8, latest commit from master
as of this writing.
Hi @augustoproiete, thanks for reviewing my PR https://github.com/augustoproiete/ookii-dialogs-wpf/pull/10.
Sorry, my response didn't clearly!
You had published 2 libraries ookii-dialogs-wpf
and ookii-dialogs-winforms
. Thank you very much for your libraries. I think it is same, and i got some issues on ookii-dialogs-winforms
so i want to PR both to fix them!
There 2 points i want to update on the PR:
- I got different result when using 2 options
VistaSaveFileDialog
andSystem.Windows.Forms.SaveFileDialog
- Option1:
var saveFileDialog = new VistaSaveFileDialog();
- Option2:
//forceDownLevel using System.Windows.Forms.SaveFileDialog
var saveFileDialog = new VistaSaveFileDialog(true);
//or saveFileDialog = new SaveFileDialog()
And using the same following code
saveFileDialog.FileName= @"E:\OneDrive";
saveFileDialog.InitialDirectory = @"D:\NewFolder";
Result:
- System.Windows.Forms.SaveFileDialog: FileName is
E:\OneDrive.txt
, Folder isD:\NewFolder
- VistaSaveFileDialog: FileName is
OneDrive.txt
, Folder isE:\
I think the should be consistency, and result should be same
- I got crash if using
VistaSaveFileDialog
but not withSystem.Windows.Forms.SaveFileDialog
Try to pass not an existing directory like@"L:\"
or@"E:\OneDrivexxxx"
var saveFileDialog = new VistaSaveFileDialog();
saveFileDialog.InitialDirectory = @"E:\OneDrivexxxx"; //OneDrivexxxx is not exist directory
They will crash!
The below code have a problem when you didn't check exist directory for variable parent
!
string folder = Path.GetFileName(_fileNames[0]);
dialog.SetFolder(NativeMethods.CreateItemFromParsingName(parent));
dialog.SetFileName(folder);
Please review this, and if have any question please send to me!