You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you experienced this same bug with .NET Framework?:
yes
Problem description: FileDialog.InitialDirectory doesn't seem to work? It works for the classic dialog, but modern dialogs seem to ignore it, even though there is source code handling it. Debugging the source seems to throw FileNotFoundException when calling GetShellItemForPath. Might be an interop mistake?
Expected behavior: FileDialog.InitialDirectory should actually set the directory.
Minimal repro:
Create and show an OpenFileDialog with a non-empty InitialDirectory (make sure you get the modern version of the dialog)
When fixing this, there is also desire to support special shell paths like "my computer". Might want to make sure that the fixed code understands these special paths when passing the string to shell API for translation, otherwise new API would be required to support them.
Also see #3512 for adding InitialDirectory to FolderBrowserDialog, in case the API suggestion gets accepted before this is fixed, otherwise both can be done together.
System.Windows.Forms.OpenFileDialog. Setting a value for the “InitialDirectory” property has no effect when running ShowDialog. Works fine with .NET Core 3.1.
Might want to reclassify as regression then, assuming 3.1 already used the new Vista dialog. (If 3.1 was still using the classic dialog, as mentioned above this still works.) My own test above already was against master so I didn't test 3.1 at all. Like mentioned above it fails during shell interop, might be interesting if 3.1 has this shell interop or is using different code.
Sorry, .NET 5.0 is complete. This may meet a servicing bar for 5.0.x.
Complete for regression fixes on rc?
I am not sure about modern/classic dialogs, but simple using of OpenFileDialog produces same dialog look on Win10 for netcoreapp3.1, net5.0-windows and net472. And InitialDirectory not working only in net5 :( So this is pure regression from .net framework and .net core3...
I'm going to have someone take another look at this ASAP. I can't promise we can get it into 5.0 GA simply because we're very close to locked down. Once we know what the root cause is and the risk of a fix we can determine if we can get it through in time for GA. If we can't, we can certainly look to it for servicing.
Tthere is a release process, and we're just one of the outer nodes on the graph. It takes weeks to prepare a public release, so we do have hard deadlines after which no change is accepted, and go into a subsequent servicing release.
Verified issue on .Net 5.0.202 & .Net 6.0 latest build: 6.0.100-Preview.4.21181.20, this issue all fixed now. FileDialog.InitialDirectory works correctly.
ghost locked as resolved and limited conversation to collaborators on Jan 31, 2022
Activity
weltkante commentedon Jun 26, 2020
When fixing this, there is also desire to support special shell paths like "my computer". Might want to make sure that the fixed code understands these special paths when passing the string to shell API for translation, otherwise new API would be required to support them.
Also see #3512 for adding
InitialDirectorytoFolderBrowserDialog, in case the API suggestion gets accepted before this is fixed, otherwise both can be done together.kirsan31 commentedon Oct 14, 2020
From yesterday rc2 blog post:
System.Windows.Forms.OpenFileDialog. Setting a value for the “InitialDirectory” property has no effect when running ShowDialog. Works fine with .NET Core 3.1.
weltkante commentedon Oct 14, 2020
Might want to reclassify as regression then, assuming 3.1 already used the new Vista dialog. (If 3.1 was still using the classic dialog, as mentioned above this still works.) My own test above already was against master so I didn't test 3.1 at all. Like mentioned above it fails during shell interop, might be interesting if 3.1 has this shell interop or is using different code.
kirsan31 commentedon Oct 14, 2020
Yes, it's regression from 3.1. Dialogs are same, 3.1 works, 5.0 - not.
Repro: OpenFileDialog.zip
Good to be fixed before 5.0 release. @RussKie ?
RussKie commentedon Oct 14, 2020
Sorry, .NET 5.0 is complete. This may meet a servicing bar for 5.0.x. /cc: @merriemcgaw
kirsan31 commentedon Oct 14, 2020
Complete for regression fixes on rc?
I am not sure about modern/classic dialogs, but simple using of
OpenFileDialogproduces same dialog look on Win10 fornetcoreapp3.1,net5.0-windowsandnet472. AndInitialDirectorynot working only in net5 :( So this is pure regression from .net framework and .net core3...merriemcgaw commentedon Oct 14, 2020
I'm going to have someone take another look at this ASAP. I can't promise we can get it into 5.0 GA simply because we're very close to locked down. Once we know what the root cause is and the risk of a fix we can determine if we can get it through in time for GA. If we can't, we can certainly look to it for servicing.
5 remaining items
JeremyKuhne commentedon Oct 14, 2020
Investigating
RussKie commentedon Oct 15, 2020
Tthere is a release process, and we're just one of the outer nodes on the graph. It takes weeks to prepare a public release, so we do have hard deadlines after which no change is accepted, and go into a subsequent servicing release.
Amy-Li03 commentedon Apr 1, 2021
Verified issue on .Net 5.0.202 & .Net 6.0 latest build: 6.0.100-Preview.4.21181.20, this issue all fixed now. FileDialog.InitialDirectory works correctly.