Skip to content

Fix initial directory and custom places in file dialogs - #4108

Merged
RussKie merged 1 commit into
dotnet:masterfrom
JeremyKuhne:filedialog
Oct 14, 2020
Merged

RussKie merged 1 commit into
dotnet:masterfrom
JeremyKuhne:filedialog

Conversation

@JeremyKuhne

@JeremyKuhne JeremyKuhne commented Oct 14, 2020 •

Copy link
Copy Markdown
Member

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.

Fixes #3513

Proposed changes

  • Add the appropriate charset marshalling directive

Customer Impact

  • InitialDirectory and CustomPlaces do not work for FileDialog
  • No customer workaround

Regression?

  • Yes

Risk

  • Very low

Test methodology

  • Wrote regression interop test
  • Manually tested the file dialog
Microsoft Reviewers: Open in CodeFlow

`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.
@JeremyKuhne
JeremyKuhne requested a review from a team as a code owner October 14, 2020 20:44
@JeremyKuhne JeremyKuhne self-assigned this Oct 14, 2020
{
[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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long term perhaps. But we'll need to service this so I want to keep this change as minimal as possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dreddy-work thank you for flagging it, raised #4112 to track

@codecov

codecov Bot commented Oct 14, 2020

Copy link
Copy Markdown

Codecov Report

Merging #4108 into master will increase coverage by 30.02192%.
The diff coverage is n/a.

@@                 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     
Flag Coverage Δ
#Debug 98.13673% <ø> (+30.02191%) ⬆️
#production ?
#test 98.13673% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@RussKie
RussKie merged commit 197420f into dotnet:master Oct 14, 2020
@ghost ghost added this to the 6.0 Preview1 milestone Oct 14, 2020
}
finally
{
if (ppidl != IntPtr.Zero)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, you can of course pass null to FreeCoTaskMem.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileDialog.InitialDirectory does not work

4 participants