dotnet/wpf · error · PrintQueueException
PrintSystemException.PrintQueue.Pause
Error message
PrintSystemException.PrintQueue.Pause
What it means
PrintQueue.Pause converts a Win32 SetPrinter(PRINTER_CONTROL_PAUSE) failure into a PrintSystemException tagged 'PrintSystemException.PrintQueue.Pause'. Pausing asks the spooler to stop scheduling jobs on the queue; the HResult holds the native error (e.g. access denied).
Solutions
- Run under an account with Manage Printer permission on the queue (printer owner or administrator).
- Check the queue still exists via PrintServer.GetPrintQueue(name) before pausing.
- Verify the spooler service is running and the network path to the print server is reachable.
- Inspect the PrintSystemException's Win32 HResult (e.g. 0x80070005 = access denied) to confirm the permission cause.
Example fix
// before
queue.Pause();
// after
try { queue.Pause(); }
catch (PrintSystemException ex)
{
if (ex.HResult == unchecked((int)0x80070005)) throw new UnauthorizedAccessException("Manage-printer permission required to pause the queue.", ex);
throw;
} Defensive patterns
Strategy: try-catch
Validate before calling
var server = new PrintServer();
bool exists = server.GetPrintQueues().Any(q => q.FullName == queue.FullName);
if (!exists || (queue.QueueStatus & PrintQueueStatus.Error) != 0) throw new InvalidOperationException("Queue unavailable for Pause"); Try / catch
try { queue.Pause(); }
catch (PrintSystemException ex) when (ex.HResult == unchecked((int)0x80070005))
{ throw new UnauthorizedAccessException("Manage-printer permission required to pause the queue.", ex); } Prevention
- Require Manage Printer permission for any queue-control operation (Pause/Purge/Resume).
- Check QueueStatus before issuing control commands.
- Inspect the PrintSystemException HResult to classify Win32 errors.
- Operate on queues re-resolved from the PrintServer, not stale references.
When it happens
Trigger: Calling queue.Pause() when the spooler rejects SetPrinter with PRINTER_CONTROL_PAUSE — typically ERROR_ACCESS_DENIED, ERROR_INVALID_PRINTER_NAME, or a disconnected remote queue.
Common situations: User is not a printer administrator/owner; pausing a connection to a shared printer where the server refuses non-admin control; queue already deleted; spooler service stopped.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- PrintSystemException.PrintQueue.Purge
- PrintSystemException.PrintServer.Commit
- PrintSystemException.PrintServer.SetDefaultPrinter
- PrintSystemException.PrintSystemJobInfo.Generic
- ArgumentException.NonNegativeValue (Parameter 'squareScale')
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/7630d540778e212c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintQueue.cpp:1281
Return Value
None
--*/
void
PrintQueue::
Pause(
void
)
{
VerifyAccess();
try
{
printerThunkHandler->ThunkSetPrinter(PRINTER_CONTROL_PAUSE);
}
catch (InternalPrintSystemException^ internalException)
{
throw CreatePrintQueueException(internalException->HResult,
"PrintSystemException.PrintQueue.Pause");
}
}
/*++
Function Name:
Purge
Description:
Deletes all the jobs in the printer
Parameters:
None
Return Value
None
--*/View on GitHub (pinned to 81131a70a4)