dotnet/wpf · error · PrintJobException

PrintSystemException.PrintSystemJobInfo.Generic

Error message

PrintSystemException.PrintSystemJobInfo.Generic

What it means

PrintSystemJobInfo.Pause failed while applying the Paused flag to the job. The Win32 spooler call raised InternalPrintSystemException, whose HRESULT is rethrown as a PrintSystemException with key 'PrintSystemException.PrintSystemJobInfo.Generic'. The job exists (it was not in the Deleted state) but the pause operation itself failed at the spooler level.

Solutions

  1. Inspect the exception's HResult for the underlying Win32 error code (e.g. access denied)
  2. Run elevated or grant the user 'Manage Documents' permission on the target printer
  3. Verify the job is still in a pausable state (Printing/Spooling) before calling Pause
  4. Check that the Print Spooler service is running and the printer is online

Example fix

// before
job.Pause(); // throws when user lacks Manage Documents
// after
if ((job.JobStatus & PrintJobStatus::Deleted) == 0 &&
    (job.JobStatus & PrintJobStatus::Completed) == 0)
{
    try { job.Pause(); }
    catch (PrintSystemException ex)
    {
        // check ex.HResult: 0x5 access denied -> request elevation/permission
    }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (job == null) throw new ArgumentNullException(nameof(job));
if ((job.JobStatus & PrintJobStatus.Deleted) != 0) return false;
if ((job.JobStatus & (PrintJobStatus.Printing | PrintJobStatus.Spooling | PrintJobStatus.Paused)) == 0) return false; // not pausable
var queue = job.HostingPrintQueue;
if (queue.IsOffline || queue.InError) return false;

Type guard

bool CanPause(PrintSystemJobInfo job) => job != null && (job.JobStatus & PrintJobStatus.Deleted) == 0;

Try / catch

try { job.Pause(); }
catch (PrintSystemException ex)
{
    if (ex.HResult == unchecked((int)0x80070005)) /* access denied: needs Manage Documents */;
    else Log.Error($"Pause failed: 0x{ex.HResult:X}");
}

Prevention

When it happens

Trigger: Calling Pause() on a PrintSystemJobInfo whose underlying spooler call (SetJob) fails — typically due to insufficient permissions (needs administrator/Manage Documents rights), the job completing before the pause lands, or the printer being offline/driver-error.

Common situations: Standard users pausing other users' jobs without 'Manage Documents' permission; print spooler service stopped; job already printing/completed so it cannot be paused; printer in error state.

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


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/ab498c5bf27faaa3. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintSystemJobInfo.cpp:415

PrintSystemJobInfo::
Pause(
    void
    )
{
    VerifyAccess();

    if (!isDeleted)
    {
        try
        {
            hostingPrintQueue->PrinterThunkHandler->ThunkSetJob(jobIdentifier, JOB_CONTROL_PAUSE);

            get_InternalPropertiesCollection("Status")->GetProperty("Status")->IsInternallyInitialized = true;
            this->JobStatusSecondary = static_cast<Int32>(jobStatus | PrintJobStatus::Paused);
        }
        catch (InternalPrintSystemException^ internalException)
        {
            throw CreatePrintJobException(internalException->HResult,
                                          "PrintSystemException.PrintSystemJobInfo.Generic");
        }
    }
    else
    {
       throw CreatePrintJobException("PrintSystemException.PrintSystemJobInfo.Deleted");
    }
}


void
PrintSystemJobInfo::
Resume(
    void
    )
{
    VerifyAccess();

View on GitHub (pinned to 81131a70a4)