-
Notifications
You must be signed in to change notification settings - Fork 426
FileSavePicker auto creates empty file after clicking OK button #5976
Copy link
Copy link
Closed
Labels
area-File accessTopics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.Topics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.feature proposal
Description
Describe the bug
The FileSavePicker creates an empty file without code.
var saveDialog = new FileSavePicker(AppWindow.Id)
{
DefaultFileExtension = ".xml",
};
saveDialog.FileTypeChoices.TryAdd("TXT", [".txt"]);
saveDialog.FileTypeChoices.TryAdd("JSON", [".json"]);
saveDialog.FileTypeChoices.TryAdd("XML", [".xml"]);
var picker = await saveDialog.PickSaveFileAsync();
// that's it, do nothing hereSteps to reproduce the bug
- Run the code above
- When the File Save dialog appear, enter non-existing name, such as
aaa.txt - Click OK
- File
aaa.txtis created!!
Expected behavior
The file is not created automatically, the FileSavePicker should only return a full path.
Screenshots
No response
NuGet package version
Windows App SDK 1.8.2: 1.8.251003001
Packaging type
Unpackaged
Windows version
Windows 11 version 24H2 LTSC (26100, June Update)
IDE
Visual Studio 2022
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-File accessTopics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.Topics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.feature proposal