microsoft / microsoft/WindowsAppSDK

Calling PrintManagerInterop.ShowPrintUIForWindowAsync() fails if app is run elevated

Open
#3,293 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-External bug elevation
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

Describe the bug

The following occurs when calling ShowPrintUIForWindowAsync() from an elevated app:

  1. The print dialog is shown initially.
  2. A fraction of a second later it's closed without any user interaction.
  3. Exactly 30 seconds later a COMException is thrown.

The exception is:

Type: System.Runtime.InteropServices.COMException
Message: OLE has sent a request and is waiting for a reply. (0x80010115)

0x80010115 is RPC_S_CALLPENDING
The exception stack trace doesn't provide any extra info.

Steps to reproduce the bug
  1. Download provided MS demo code from https://github.com/marb2000/PrintSample
  2. Update project's WinAppSdk nuget package to the latest
  3. Build and deploy packaged target
  4. Right click app in start menu and select run as administrator
  5. Attempt to print
Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.2.2

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

May be similar to the problems that the file pickers have when running elevated #2504

Contributor guide

No contributing guide indexed for this repository

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 with the PrintSample demo and the PrintManagerInterop.ShowPrintUIForWindowAsync() call, reproducing it as an elevated packaged app on Windows 11 22H2 with Windows App SDK 1.2.2. Compare the behavior with the related file-picker issue #2504. Done should be established once printing no longer closes the dialog immediately or ends with the 30-second RPC_S_CALLPENDING COMException.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.