Skip to content
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

[BUG] FolderPicker throws ComException on Standalone Non-MSIX app #2470

Closed
2 tasks done
Captnwalker1 opened this issue Jan 24, 2025 · 7 comments
Closed
2 tasks done
Labels
bug Something isn't working unverified

Comments

@Captnwalker1
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

#f03c15 !!! Change Platform to x64 and Target to Self-Contained !!! #f03c15

When running app with launchSetting command name Project, so a unpackaged standalone non-msix app. App runs fine but when attempting to show a folder picker you get a COMException.

Also in log see the following error:
mincore\com\oleaut32\dispatch\ups.cpp(2122)\OLEAUT32.dll!00007FFAD02AA726: (caller: 00007FFAD02A9B39) ReturnHr(1) tid(1bc24) 8002801D Library not registered.

However, if you publish the MAUI app all works as expected.
dotnet publish .\MauiFolderPickerBroken\MauiFolderPickerBroken.csproj -f:net9.0-windows10.0.19041.0 -p:TargetFrameworks=net9.0-windows10.0.19041.0 -p:Version=99.9.9.9 -p:Platform=x64 -c:Debug --output C:\a\folderpicker9\ -p:WindowsPackageType=None --self-contained

Tried Release vs Debug, no difference.
Net8 vs Net9, no difference.
MauiVersion 8.0.100 vs 8.0.3, no difference. Believe it used to work on 8.0.3 but maybe due to workload updates it no longer does.
Also Tried CommunityToolkit V11 and V10 and issue persists.

Left the example at MauiVersion 8.0.100 as thats what my app is currently locked at due to client support obligations, which is also the reason we have to build as standalone exe, not MSIX as windows store is disabled on client devices.

Running as normal "Windows Machine" MSIX and folder picker works fine.
Not sure if this is a maui, communitytoolkit, or winappruntime/winappsdk bug.

Expected Behavior

Folder picker to open and allow you to pick a folder and return successful result.

Steps To Reproduce

  1. Open Solution
  2. Change Platform to x64
  3. Change Target to Self-Contained
  4. Build solution
  5. Click Run "Self-Contained" button
  6. Click "Pick Folder" Button in app
  7. Observe Error in debug console

Link to public reproduction project repository

https://github.com/Captnwalker1/MauiFolderPickerBroken

Environment

- .NET MAUI CommunityToolkit: 9.1.1, 10.0.0, 11.0.0
- OS: Windows 10.0.19045 Build 19045
- .NET MAUI: 8.0.100

Anything else?

No response

@Captnwalker1 Captnwalker1 added bug Something isn't working unverified labels Jan 24, 2025
@ne0rrmatrix
Copy link
Contributor

We do not support dotnet 8.x. We currenlty only support dotnet 9.x with current release of Community toolkit. Please update to dotnet 9.x If you still have issues with this after updating please create a new issue.

Requirements

The following tools are now required for CommunityToolkit.Maui.:

  • Download/install .NET SDK v9.0.101
  • Install Xcode 16.1.0
    • Read the latest .NET MAUI Release wiki to always find the latest-supported version) of Xcode for .NET MAUI
    • We HIGHLY recommend using the open-source tool Xcodes to easily manage your installed Xcode versions
  • Update to the latest stable version of Visual Studio (or Jet Brains Rider)
  • After installing the latest stable .NET SDK, update to the latest stable version of the .NET MAUI workload:
    • On macOS, open the Terminal and enter the following command: sudo dotnet workload install maui
    • On Windows, open the command prompt (or Powershell) and enter the following command: dotnet workload install maui
  • Add a global.json file to your application with the following parameters to ensure you're not using a unsupported preview version of .NET (example below)
    • The .NET MAUI Community Toolkit does not support preview releases of .NET

global.json

{
  "sdk": {
    "version": "9.0.101", 
    "rollForward": "latestFeature",
    "allowPrerelease": false
  }
}
  • .NET 8 no longer supported

  • Xcode 16.1 Required

  • Increase minimum supported OS versions of CommunityToolkit.Maui.MediaElement

    • Android 26.0
    • iOS 15.0
    • MacCatalyst 15.0
  • Increase minimum supported versions of CommunityToolkit.Maui.Camera to 15.0:

    • iOS 15.0
    • MacCatalyst 15.0

@Captnwalker1
Copy link
Author

Please re-examine.
This is happening on both 8 and 9.

@ne0rrmatrix ne0rrmatrix reopened this Jan 26, 2025
@ne0rrmatrix
Copy link
Contributor

I looked at the sample app. It does crash when compiling. If you look at the error it says the version of WindowsAppSdk is not compatible. Try updating that. I just created an app with sample code from you main page copy pasted and I was able to run it unpackaged as x64. You should not need to manually set up or adjust the windows app sdk. The minimum supported package version for the sdk is 1.6.x last time I checked. the 1.5 version you specified will not work the community toolkit.

@Captnwalker1
Copy link
Author

The app does not crash on compile for me? The app runs, but when you attempt to pick a folder it never shows the folder picker UI and outputs the error to console.

The build and run was working friday but now I have to right click the project and hit build first. Then can hit run.

I did not specify the WinAppSDK version?

I just tried specifying the latest 1.6.250108002 and the error is still present?

System.Runtime.InteropServices.COMException (0x80004005)
   at CommunityToolkit.Maui.Storage.FolderPickerImplementation.InternalPickAsync(String initialPath, CancellationToken cancellationToken) in /_/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs:line 27
   at CommunityToolkit.Maui.Storage.FolderPickerImplementation.InternalPickAsync(String initialPath, CancellationToken cancellationToken) in /_/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.windows.cs:line 33
   at CommunityToolkit.Maui.Storage.FolderPickerImplementation.PickAsync(CancellationToken cancellationToken) in /_/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.shared.cs:line 26

@ne0rrmatrix
Copy link
Contributor

From what I understand your client is locked to dotnet 8? We do not support dotnet 8.x at all with the release of dotnet 9 support. We are all volunteers who have limited time and we offer support only for current version of dotnet maui which is using dotnet 9.x. This issue is reported as being an issue for dotnet 9.x too so this report will stay open. We do not plan to backport a fix for older versions of dotnet. If there are any workarounds please continue to use them.

@Captnwalker1
Copy link
Author

Yes we plan to upgrade to Net 9 later this year but are unable to at the moment.

Its just really odd it only happens when launched from VS, when published or even run from the bin folder manually it works.

@ne0rrmatrix
Copy link
Contributor

I have created a sample repo for those using dotnet 9.x with an example of how to use folder picker:
https://github.com/ne0rrmatrix/FolderPickerSample

For more information on how to configure your app on how to use Foler Picker please look here:
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/essentials/folder-picker?tabs=windows

There are a number of steps you need to take including editing device specific settings in the platform folder for each device type.
I am going to close this as the sample app version works and it was tested as both a packaged and unpackaged windows 10 x64 app.
The issue with visual studio failing to behave as expected is outside our ability to support. If it runs as debug/release from a folder I would suggest upgrading to dotnet 9 when you can and just test from the folder for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

2 participants