Repository navigation
Fix initial directory and custom places in file dialogs - #4108
Conversation
`FileDialog.InitialDirectory` and `FileDialog.CustomPlaces` do not work as paths we're incorrectly marshalled as ANSI. Wrote an interop regression test and manually validated the two scenarios.
| { | ||
| [DllImport(Libraries.Shell32, ExactSpelling = true)] | ||
| [DllImport(Libraries.Shell32, ExactSpelling = true, CharSet = CharSet.Unicode)] | ||
| public static extern HRESULT SHILCreateFromPath(string pszPath, out IntPtr ppidl, ref uint rgflnOut); |
There was a problem hiding this comment.
Does it make sense to replace this API with newer one? https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shilcreatefrompath
There was a problem hiding this comment.
Long term perhaps. But we'll need to service this so I want to keep this change as minimal as possible.
There was a problem hiding this comment.
@dreddy-work thank you for flagging it, raised #4112 to track
Codecov Report
@@ Coverage Diff @@
## master #4108 +/- ##
====================================================
+ Coverage 68.11481% 98.13673% +30.02191%
====================================================
Files 1482 494 -988
Lines 508766 258309 -250457
Branches 41448 4479 -36969
====================================================
- Hits 346545 253496 -93049
+ Misses 155986 4051 -151935
+ Partials 6235 762 -5473
Flags with carried forward coverage won't be shown. Click here to find out more. |
| } | ||
| finally | ||
| { | ||
| if (ppidl != IntPtr.Zero) |
There was a problem hiding this comment.
Nit, you can of course pass null to FreeCoTaskMem.
FileDialog.InitialDirectoryandFileDialog.CustomPlacesdo not work as paths we're incorrectly marshalled as ANSI.Wrote an interop regression test and manually validated the two scenarios.
Fixes #3513
Proposed changes
Customer Impact
InitialDirectoryandCustomPlacesdo not work forFileDialogRegression?
Risk
Test methodology
Microsoft Reviewers: Open in CodeFlow