Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash for SaveFileDialog when using root directory #9

Open
zappu9x opened this issue Oct 9, 2019 · 2 comments
Open

Crash for SaveFileDialog when using root directory #9

zappu9x opened this issue Oct 9, 2019 · 2 comments

Comments

@zappu9x
Copy link

zappu9x commented Oct 9, 2019

  • Bug crash of VistaFolderBrowserDialog when using root directory path (same for VistaSaveFileDialog when directory is "L:\" (not exist) and default file name is empty)
@augustoproiete
Copy link
Member

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.

@zappu9x
Copy link
Author

zappu9x commented Oct 10, 2019

Hi @augustoproiete, thanks for reviewing my PR #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:

  1. I got different result when using 2 options VistaSaveFileDialog and System.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 is D:\NewFolder
  • VistaSaveFileDialog: FileName is OneDrive.txt, Folder is E:\
    I think the should be consistency, and result should be same
  1. I got crash if using VistaSaveFileDialog but not with System.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants