{"record":{"id":"ab498c5bf27faaa3","repo":"dotnet/wpf","slug":"printsystemexception-printsystemjobinfo-generic-ab498c","errorCode":null,"errorMessage":"PrintSystemException.PrintSystemJobInfo.Generic","messagePattern":"PrintSystemException\\.PrintSystemJobInfo\\.Generic","errorType":"exception","errorClass":"PrintJobException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintSystemJobInfo.cpp","lineNumber":415,"sourceCode":"PrintSystemJobInfo::\nPause(\n    void\n    )\n{\n    VerifyAccess();\n\n    if (!isDeleted)\n    {\n        try\n        {\n            hostingPrintQueue->PrinterThunkHandler->ThunkSetJob(jobIdentifier, JOB_CONTROL_PAUSE);\n\n            get_InternalPropertiesCollection(\"Status\")->GetProperty(\"Status\")->IsInternallyInitialized = true;\n            this->JobStatusSecondary = static_cast<Int32>(jobStatus | PrintJobStatus::Paused);\n        }\n        catch (InternalPrintSystemException^ internalException)\n        {\n            throw CreatePrintJobException(internalException->HResult,\n                                          \"PrintSystemException.PrintSystemJobInfo.Generic\");\n        }\n    }\n    else\n    {\n       throw CreatePrintJobException(\"PrintSystemException.PrintSystemJobInfo.Deleted\");\n    }\n}\n\n\nvoid\nPrintSystemJobInfo::\nResume(\n    void\n    )\n{\n    VerifyAccess();\n","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintSystemJobInfo.cpp#L397-L433","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the exception's HResult for the underlying Win32 error code (e.g. access denied)","Run elevated or grant the user 'Manage Documents' permission on the target printer","Verify the job is still in a pausable state (Printing/Spooling) before calling Pause","Check that the Print Spooler service is running and the printer is online"],"exampleFix":"// before\njob.Pause(); // throws when user lacks Manage Documents\n// after\nif ((job.JobStatus & PrintJobStatus::Deleted) == 0 &&\n    (job.JobStatus & PrintJobStatus::Completed) == 0)\n{\n    try { job.Pause(); }\n    catch (PrintSystemException ex)\n    {\n        // check ex.HResult: 0x5 access denied -> request elevation/permission\n    }\n}","handlingStrategy":"try-catch","validationCode":"if (job == null) throw new ArgumentNullException(nameof(job));\nif ((job.JobStatus & PrintJobStatus.Deleted) != 0) return false;\nif ((job.JobStatus & (PrintJobStatus.Printing | PrintJobStatus.Spooling | PrintJobStatus.Paused)) == 0) return false; // not pausable\nvar queue = job.HostingPrintQueue;\nif (queue.IsOffline || queue.InError) return false;","typeGuard":"bool CanPause(PrintSystemJobInfo job) => job != null && (job.JobStatus & PrintJobStatus.Deleted) == 0;","tryCatchPattern":"try { job.Pause(); }\ncatch (PrintSystemException ex)\n{\n    if (ex.HResult == unchecked((int)0x80070005)) /* access denied: needs Manage Documents */;\n    else Log.Error($\"Pause failed: 0x{ex.HResult:X}\");\n}","preventionTips":["Ensure the account has 'Manage Documents' permission on the target printer","Check JobStatus before mutating job state","Confirm the Print Spooler service is running","Run elevated when pausing jobs owned by other users"],"tags":["wpf","printing","spooler","permissions"],"backgroundTag":"permission-denied","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}