maui: [Bug] FilePicker throws COMException on Windows

Description

On WinUI projects on the Windows platform, using the PickAsync and PickMultipleAsync methods from the FilePicker class in Essentials results in a System.Runtime.InteropServices.COMException being thrown. The error message returned in the exception is “Invalid window handle. (0x80070578)”.

I’m not sure if the issue lies within MAUI or WinUI itself.

Steps to Reproduce

  1. Create a new MAUI project and add a button to the main page
  2. Add a clicked event to the button with the following handler method:
    async private void ButtonClicked(object sender, EventArgs args)
    {
        FileResult file = await FilePicker.PickAsync();
    }
    
  3. Run the app on Windows and click the button

Expected Behavior

The file open dialog should appear.

Actual Behavior

An exception is thrown and the application crashes.

Basic Information

  • Version with issue: MAUI Preview 7
  • Last known good version: Not known
  • IDE: Visual Studio 2022 Preview 3.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Where is this at? Do we have a timeline for when the fix to these will drop?