[Bug] FilePicker throws System.InvalidOperationException: 'Window Not Found'
See original GitHub issueDescription
In maui preview7 on android, whenever call FilePicker.PickAsync();
method the maui application will throw System.InvalidOperationException: 'Window Not Found'
and crash.
Steps to Reproduce
- create a new maui app using default maui templat
- setup permissions and call platform init on android
- add
await FilePicker.PickAsync();
in button onclick event handler and start debug - click the button
Expected Behavior
the filepicker shows up
Actual Behavior
the filepicker shows up, then the app throws System.InvalidOperationException: 'Window Not Found'
and crash.
Basic Information
- Version with issue: maui preview7
- Last known good version: maui preview6
- IDE: VIsual Studio 2022 preview 3
- Platform Target Frameworks:
- iOS:
- Android:
- UWP:
- Android Support Library Version:
- Nuget Packages:
- Affected Devices:android
Screenshots
Reproduction Link
https://github.com/Chronostasys/ButtonTest
Workaround
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:8 (1 by maintainers)
Top Results From Across the Web
C# WinUI 3 I cannot use the file specified from a ...
C# WinUI 3 I cannot use the file specified from a FileSavePicker dialog to create an excel report file - Stack Overflow.
Read more >"File Picker UI Host has stopped working" error in every ...
The error message of "File Picker UI Host has stopped working" pops up every time after the splash screen; it's benign but annoying....
Read more >Changelog | Input System | 1.7.0
Fixed the "Release tests throws exception in InputSystem" bug (case ISXB-581). Fixed issues with generating Precompiled Layouts for devices which are not ......
Read more >TriLib - Model Loading Package | Page 25
An error ocurred while loading your Model: System. ... throw new Exception($"File {originalFilename} not found.");.
Read more >Open file picker interface programatically on xamarin android
My Droid Packagemap has no visible packages (deleted them all) and when I try to add a new version of Xamarin it gives...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am seeing the same issue on Preview 7 on Android, in my case when attempting to open a custom tab via MSAL.NET. I’ve tried with the embedded browser as well, same issue, so it seems to be related to the launching of any new activity, or more specifically, the default MAUI OnResume callbacks. Here is a full stack trace upon crash. It appears that something in the MAUI OnResume handlers could be passing the wrong Window object up the chain?
At the moment the new activity is created, the following log code added to OnResume:
returns this:
I do see new PR activity around CreateWindow in #2035 by @mattleibow, but it didn’t make it into Preview 7, and seems to revolve around more of an app launch timing issue than anything.
This bug still persist on preview 9. Is there a temporary workaround atm? Thank you