I am using the FolderBrowserDialog to select the Folder where user can save file. While opening the folder browse dialog, application get crashed and raised below exception.
System.InvalidOperationException: Unable to retrieve the root folder.
at System.Windows.Forms.FolderBrowserDialog.RunDialog(IntPtr hWndOwner)
at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
at TestApp.GenerateExcelReport()
Users are using the applications from cloud as My application is launched on Citrix Environment. Hence not all the users has facing this issue but few of them are facing.
string folderPath = "X:\\Reports";
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
FolderBrowserDialog folderDialog = new FolderBrowserDialog();
folderDialog.ShowNewFolderButton = true;
folderDialog.SelectedPath = folderPath;
DialogResult dialogResult = folderDialog.ShowDialog();
if (dialogResult == DialogResult.OK)
{
folderPath = folderDialog.SelectedPath;
}
else
{
return;
}
Kindly suggest what can be the root cause of getting this issue while showing the FolderBrowseDialog. Also, suggest the potential fixes to prevent this exception.
Thanks & Regards,
Hiren Lad