-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileOpenPicker, FileSavePicker, and FolderPicker break in WinUI3 Desktop #2716
Comments
@stevenbrix and @Scottj1s, @llongley thinks this is a CSWinrt issue. FYI. |
I can't tell from the documentation, it could be that these pickers don't work in a Desktop (hwnd rather than CoreWindow) app. |
It works if no debugger is attached, or if the Native Only debugger is attached. This seems like a tooling issue, or a Dot Net Core runtime issue. I believe these pickers worked fine on Xaml Islands. |
I can't get any pickers to work at all in a Desktop (HWND) Win32 app using C++/WinRT. necore\shell\lib\calleridentity\callerwindow_twinapi.cpp(116)\twinui.appcore.dll!00007FF8D3EC0BDC: (caller: 00007FF8D3E91E10) ReturnHr(1) tid(cd18) 80040155 Interface not registered winrt::fire_and_forget MainWindow::ShowPicker() EDIT: |
Since WinUI3 allows multiple windows on the same thread, the pickers can no longer assume there's just one and use it as the owner. You will need to use the IInitializeWithWindow interface to give the hint. Looks like the documentation has been updated to give some clues about this now: |
This issue is closed but I still face the same exact issue and I can not find a solution in this thread. The given workaround to "set the Debug -> Debugger Type -> Application proccess to Native Only" works but the hability to debug Managed code is considered essential in our development workflow so is not a long term solution. I use |
@angelazhangmsft are you able to confirm if this issue has been fixed? I thought there was an associated C#/WinRT issue for this, but am not seeing it in this thread. |
@angelazhangmsft From what I could tell these are not C#/WinRT issues. When I encountered this it was with XCG and had to do with their implementation -- I made an issue there microsoft/WinUI-Gallery#559 Doesn't look like it has been fixed. @stevenbrix is this the issue you are talking about? I think it is a different issue than the one discussed here. |
@j0shuams the symptom of this issue is that debugging a .NET app with just the native debugger works, but when you attach the managed debugger, you get an issue. I can't tell from that linked issue whether that is the same issue as this one, but my gut is that it isn't (I could be wrong of course) |
@stevenbrix No I don't think the two are related (the issue I linked and this one). My understanding of the issue of this thread was it had to do with providing a window handle hint to Picker objects (FileSavePicker, etc). I don't think there is a C#/WinRT issue about debugging with managed being broken -- is that a C#/WinRT issue? I don't think I know enough to make that call; if you think so then youcould open an issue on that repo. Let me know how else I can help |
Apologies for closing this and missing that IInitializeWithWindow was already being used. I'll reopen this until folks figure out whether this is a WinUI3 or CSWinRT issue and route the bug report accordingly. |
Thanks everybody for participating on this issue. I have updated the WinUI 3 Demos to the Preview 3 and it seems that every scenario works now. I'll close the issue. Regards! |
The workaround described by @akanieski does only work when using PickSingleFileAsync(). See: https://gist.github.com/wbokkers/cc8bcc7bc5a646b82a4d41b337330c69#gistcomment-3649439 |
@wbokkers - I think that issue may be better tracked on the Project Reunion repo here: https://github.com/microsoft/ProjectReunion Could you file that new issue there? Thanks! |
@Austin-Lamb @wbokkers I have created a new issue in the Project Reunion repository. See mentioned issue above! |
I'm getting an error trying to use IInitializeWithWindow with a c++ app. #5218 |
This still happens in .NET 6.0.100-rc.1.21458.32 using VS 2022 Preview in a MAUI Blazor project. |
On .NET 6.0 RTM too |
@marb2000 any info about that? |
Why is this closed while the API is still broken? @marb2000 |
The team is looking to improve the pattern for these APIs that require interop with IInitializeWithWindow. I've started a discussion at microsoft/WindowsAppSDK#1887! |
Describe the bug
The FileOpenPicker, FileSavePicker, and FolderPicker in the WinUI3 Desktop sample solution break and close the application.
Steps to reproduce the bug
Clone the WinUI3 Problems FilePicker repository.
Go to the FilePickerWinUI folder.
Open the FilePickerWinUI solution in Visual Studio 2019 Preview.
Build and run with Debug x64.
Test each button
A. FileOpenPicker
B. FileSavePicker
C. FolderPicker
Expected behavior
We expect the application to display the path of the selected file(s) or folder.
We expect the FileOpenPicker, FileSavePicker, and FolderPicker to allow the user to select files or a folder.
Screenshots
Screenshot#1 - Current Behavior (Error Message)
Screenshot#2 - Application Appearance
Version Info
NuGet package version:
[Microsoft.VCRTForwarders.140 1.0.6]
[Microsoft.WinUI 3.0.0-preview1.200515.3]
Targeting:
Target: Universal Windows
Target version: Windows 10, version 1809 (10.0; Build 17763)
Min version: Windows 10, version 1809 (10.0; Build 17763)
Additional context
We copied the related C# code from the microsoft/WinUI-3-Demos.
You will see this in App.xaml.cs and MainWindow.xaml.cs.
If we set the Debug -> Debugger Type -> Application proccess to Native Only, then the FolderPicker will work without crashing. However, the other two buttons will still not work.
The text was updated successfully, but these errors were encountered: