ShowOpenDialogAsync doesn't return when openDirectory is used on Mac #659

Closed
opened 2026-01-29 16:45:23 +00:00 by claunia · 1 comment
Owner

Originally created by @gbreen12 on GitHub (May 11, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Electron.NET Version: 11.5.1
Electron.NET CLI Version: 11.5.1
.NET Version: .NET 5.0.202
NodeJS Version: 14.16.1

Using Visual Studio Code on Mac

A dialog opens and I select a directory but it never returns any results. If I use openFile instead I get a file directory but openDirectory never works.

@page "/"

@using ElectronNET.API;
@using ElectronNET.API.Entities;

<h1>Fix Exif Data</h1>

<div>
    <div>SELECTED FOLDER: @folder</div>
    <button @onclick="GetFolder" class="btn btn-primary">Select Image Folder Location</button>    
</div>

@code {
    string folder = "";

    private async void GetFolder()
    {
        var mainWindow = Electron.WindowManager.BrowserWindows.First();
        var options = new OpenDialogOptions() {
            Properties = new OpenDialogProperty[] { OpenDialogProperty.openDirectory }
        };
        
        var results = await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options);
        if (results.Any())
            folder = results.First();
    }
}
Originally created by @gbreen12 on GitHub (May 11, 2021). Originally assigned to: @GregorBiswanger on GitHub. Electron.NET Version: 11.5.1 Electron.NET CLI Version: 11.5.1 .NET Version: .NET 5.0.202 NodeJS Version: 14.16.1 Using Visual Studio Code on Mac A dialog opens and I select a directory but it never returns any results. If I use `openFile` instead I get a file directory but `openDirectory` never works. ``` @page "/" @using ElectronNET.API; @using ElectronNET.API.Entities; <h1>Fix Exif Data</h1> <div> <div>SELECTED FOLDER: @folder</div> <button @onclick="GetFolder" class="btn btn-primary">Select Image Folder Location</button> </div> @code { string folder = ""; private async void GetFolder() { var mainWindow = Electron.WindowManager.BrowserWindows.First(); var options = new OpenDialogOptions() { Properties = new OpenDialogProperty[] { OpenDialogProperty.openDirectory } }; var results = await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options); if (results.Any()) folder = results.First(); } } ```
claunia added the bug label 2026-01-29 16:45:23 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#659