microsoft / microsoft/CsWinRT

Bug: Cannot launch folder pickers in LowIL mode (partial trust)

Open
#1,986 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
665
Forks
134
Avg merge
1d 3h
Merged PRs (30d)
32

Description

Description

When running a WinUI 3 app in lowIL mode (as UWP does), you cannot call he folder pickers.

System.UnauthorizedAccessException when trying to use WinRT.Interop.InitializeWithWindow.Initialize(folderPicker, hwnd);

This is because hwnd is not allowed in LowIL mode.

This prevents UWP migration.

Steps To Reproduce

WinRT.Interop.InitializeWithWindow.Initialize(folderPicker, hwnd);

Expected Behavior

This line is only required because of the implementation of the MainWindow and is for interrop. But doesn't provide for the high security requirements of LowIL mode.

I expect he pickers to launch

We know this doesn't work for admin mode (privelaged access) either and the WASDK team have created a new API specifically for that. But that new API also doesn't work in low privelage mode.

Version Info

WASDK 1.7
csWinRT 2.2

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating the WinRT.Interop.InitializeWithWindow.Initialize(folderPicker, hwnd) entry point and how folder pickers are activated in lowIL mode. Reproduce the UnauthorizedAccessException under lowIL and compare the behavior with the documented privileged-mode picker API. Done means folder pickers launch successfully in lowIL without violating its security restrictions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.