Bug 57732 - Downloads folder on UWP doesn't understand CreationCollisionOption
Summary: Downloads folder on UWP doesn't understand CreationCollisionOption
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-06-23 22:50 UTC by Yuri
Modified: 2017-06-26 15:55 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Yuri 2017-06-23 22:50:05 UTC
The code below works for Local and Temporary folders:
var pdfBytes = new byte[] {1,2,3};
StorageFolder storageFolder = ApplicationData.Current.LocalFolder; //or  ApplicationData.Current.TemporaryFolder
StorageFile pdfFile = await storageFolder.CreateFileAsync("my.pdf", CreationCollisionOption.ReplaceExisting);
write data to created file
await FileIO.WriteBytesAsync(pdfFile, pdfBytes);

When I use Downloads folder and file already exist I get an exception in the follow line:
StorageFile pdfFile = await DownloadsFolder.CreateFileAsync("my.pdf", CreationCollisionOption.ReplaceExisting);
Exception states: "Invalid Parameter". If I save file first time (it doesn't exists yet) it works.
Comment 1 Jimmy [MSFT] 2017-06-26 15:55:54 UTC
This does not appear to be related to Xamarin since the code shown is all UWP platform code. For assistance with UWP platform issues, I would recommend creating a question on MSDN[1]. For more UWP support options, please see this page[2]. Thank you!

[1] https://social.msdn.microsoft.com/Forums/windowsapps/en-US/home?forum=wpdevelop
[2] https://developer.microsoft.com/en-us/windows/support