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

Fix WellKnownFolder.Downloads on Windows #17107

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

stevemonaco
Copy link
Contributor

What does the pull request do?

Fixes querying StorageProvider.TryGetWellKnownFolderAsync for WellKnownFolder.Downloads on Windows. Addresses #17086

This code can be removed in the future once .NET adds managed support, but it's not happening for .NET 9.

What is the current behavior?

Returns a null string on Windows because the DllImport signature doesn't match the win32api signature due to PreserveSig = false being omitted.

What is the updated/expected behavior with this PR?

Returns the download folder.

How was the solution implemented (if it's not obvious)?

Removed runtime marshalling. Properly use Marshal.FreeCoTaskMem to free the ppszPath as per documentation, even in cases where the method fails.

Checklist

Fixed issues

Fixes #17086

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0052053-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Sep 24, 2024
Merged via the queue into AvaloniaUI:master with commit aa18de5 Sep 24, 2024
11 checks passed
@stevemonaco stevemonaco deleted the issue17086 branch September 27, 2024 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IStorgeProvider not returning Download WellKnownFolders on Windows 11
3 participants