Skip to content
Discussion options

You must be logged in to vote

what am I doing wrong?

This:

        public string SelectFolder(string title)
        {
            Task<string> task = Task.Run(() => SelectFolderAsync(title));
            return task.Result;
        }

You should not do sync over async in GUI applications.

// ui thread - this doesn't show a picker on Windows nor Mac

Because you blocked UI thread by SelectFolder call above.

// normal thread - works on Windows, crashes on Mac 10.15

Because macOS requires file picker to run on UI thread.

In 11.0 there are some hacks to make it work, but these only help with macos, but not mobile/wasm.

Make your code properly async. And it will work as designed - asynchronously and on UI thread.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by c64audio
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants