Consider the following code:
private async Task ShowOpenFileDialogAsync(){ BrowserWindow? mainWindow = Electron.WindowManager.BrowserWindows.First(); OpenDialogOptions options = new() { Title = "Choose a file", Properties = [OpenDialogProperty.openFile], Filters = [new FileFilter { Name = "JSON Files", Extensions = ["json"] }] }; await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options); Console.WriteLine("done");}This is called from Blazor like so:
<button @onclick="ShowOpenFileDialogAsync">Open</button>This displays the open file dialog, but "done" is never printed to the console, indicating that Electron.Dialog.ShowOpenDialogAsync never returns anything.
Have I missed something somewhere? I can't seem to find any documentation about how to interact with dialogs to know whether this code is correct or not.
Note:
- OS = macOS Sequoia
- ElectronNET = version 23.6.2
- App = Blazor Server .NET 8.0