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

SaveFilePickerAsync select overwritefile, return result is null #17959

Open
Misacky opened this issue Jan 13, 2025 · 4 comments
Open

SaveFilePickerAsync select overwritefile, return result is null #17959

Misacky opened this issue Jan 13, 2025 · 4 comments

Comments

@Misacky
Copy link

Misacky commented Jan 13, 2025

Describe the bug

SaveFilePickerAsync select overwritefile, return result is null

To Reproduce

var result = await storageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{
Title = "保存文件",
SuggestedFileName = fileName
});
return result?.Path.AbsolutePath ?? "";

Expected behavior

No response

Avalonia version

11.2.3

OS

Windows

Additional context

No response

@Misacky Misacky added the bug label Jan 13, 2025
@FishEagle
Copy link

Are you getting this every time?

It seems to work fine when I try it.

Note that if you select 'No' in the Confirm Save As dialog when it asks 'Do you want to replace it?' and then click Cancel or otherwise close the Save File dialog, it is correct/intended behaviour for the result to be null.

@Misacky
Copy link
Author

Misacky commented Jan 16, 2025

I want to obtain the replaced path for displaying in the TextBoxWhen it asks 'Do you want to replace it?',I select Confirm
replace it,But the return result is null.
1
2
3

@FishEagle
Copy link

Ah OK, I was using the Avalonia.Win32.Win32StorageProvider which works, but if I switch to the Avalonia.Dialogs.ManagedStorageProvider (by adding .UseManagedSystemDialogs() to my BuildAvaloniaApp())
then I am getting the same error, with the null returned when I choose to replace the file - so I believe this is something that needs to be fixed.

Same behavior already in Avalonia 11.2.1

A possible workaround would be to switch to the native StorageProvider until it gets fixed, if that is possible for you.

@Misacky
Copy link
Author

Misacky commented Jan 17, 2025

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants