{"record":{"id":"7ddeeb9863633a17","repo":"dotnet/wpf","slug":"printsystemexception-printsystemjobinfo-reportjobprogress","errorCode":null,"errorMessage":"PrintSystemException.PrintSystemJobInfo.ReportJobProgress","messagePattern":"PrintSystemException\\.PrintSystemJobInfo\\.ReportJobProgress","errorType":"exception","errorClass":"PrintJobException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PremiumPrintStream.cpp","lineNumber":558,"sourceCode":"    // last commit operation and get reset to 0 as the data is commited.\n    // If interleaving is not enabled we write the data when the stream is closed,\n    // in which case bytesToCommit should be the total length of the stream.\n    //\n    if (e->Action == PackagingAction::FixedPageCompleted &&\n        commitStreamDataOnClose == false)\n    {\n        CommitDataToPrinter();\n    }\n\n    try\n    {\n        printerThunkHandler->ThunkReportJobProgress(jobIdentifier,\n                                                        JobOperation::JobProduction,\n                                                        e->Action);\n    }\n    catch(InternalPrintSystemException^ internalException)\n    {\n        throw PrintSystemJobInfo::CreatePrintJobException(internalException->HResult,\n                                      \"PrintSystemException.PrintSystemJobInfo.ReportJobProgress\");\n    }\n}\n\nvoid\nPrintQueueStream::\nCommitDataToPrinter(\n    void\n    )\n{\n    Int64 commited  = 0;\n    try\n    {\n        //\n        // The the spool file position to the last position up to which\n        // the data was commited. Spooler will move the file pointer to the new position.\n        // If we don't do this, the position will be moved by the Spooler beyond the end of the file.\n        //","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PremiumPrintStream.cpp#L540-L576","documentation":"Raised from ReportJobProgress when the internal call to ThunkReportJobProgress (telling the spooler the job is progressing/producing) fails with an InternalPrintSystemException. The HRESULT is wrapped into a PrintSystemException with key PrintSystemException.PrintSystemJobInfo.ReportJobProgress. It indicates the progress report to the spooler could not be delivered for the given jobIdentifier.","triggerScenarios":"Calling the internal ReportJobProgress path (used during XPS/print pipeline progress reporting, e.g. from PrintSystemJobInfo progress events) with an invalid or completed job id, or when the spooler rejects the JobOperation.JobProduction report.","commonSituations":"Job finished/deleted before the progress event fired; spooler service unavailable; progress reporting wired to a job that came from a different PrintServer/queue instance.","solutions":["Check that the job is still active (JobStatus) before reporting progress and skip the report if it is not","Catch PrintSystemException in job progress event handlers so a failed report does not crash printing","Ensure the jobIdentifier corresponds to a job created on the same PrintQueue/server connection","Confirm the Print Spooler service is healthy if the error recurs across jobs"],"exampleFix":"// before\njobInfo.ReportJobProgress(...); // may throw\n// after\nif ((jobInfo.JobStatus & PrintJobStatus.Completed) == 0)\n{ try { jobInfo.ReportJobProgress(...); } catch (PrintSystemException) { /* skip stale progress report */ } }","handlingStrategy":"try-catch","validationCode":"if (jobInfo == null) return;\nif ((jobInfo.JobStatus & (PrintJobStatus.Completed | PrintJobStatus.Deleted | PrintJobStatus.Error)) != 0) return;","typeGuard":"static bool IsJobActive(PrintSystemJobInfo j) => j != null && (j.JobStatus & (PrintJobStatus.Completed | PrintJobStatus.Deleted)) == 0;","tryCatchPattern":"try { ReportJobProgress(...); }\ncatch (PrintSystemException ex) { Log(\"progress report failed: 0x\" + ex.HResult.ToString(\"X\")); }","preventionTips":["Check JobStatus before reporting progress","Fire progress events from the same PrintQueue connection that created the job","Never let progress-report failures crash the print pipeline","Monitor spooler health if progress reports fail systematically"],"tags":["wpf","printing","spooler","job-progress"],"backgroundTag":"print-job-failed","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}