Calling PrintManagerInterop.ShowPrintUIForWindowAsync() fails if app is run elevated
Describe the bug
The following occurs when calling ShowPrintUIForWindowAsync() from an elevated app:
- The print dialog is shown initially.
- A fraction of a second later it's closed without any user interaction.
- 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
- Download provided MS demo code from https://github.com/marb2000/PrintSample
- Update project's WinAppSdk nuget package to the latest
- Build and deploy packaged target
- Right click app in start menu and select run as administrator
- 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
same as:
-
https://github.com/microsoft/WindowsAppSDK/issues/2504.
-
https://github.com/microsoft/WindowsAppSDK/issues/5162.
-
https://github.com/microsoft/WindowsAppSDK/issues/5167.