dotnet/wpf · error · PrintQueueException

PrintConfig.Provider.MergeValidateFail

PrintConfig.Provider.MergeValidateFail

Error message

PrintConfig.Provider.MergeValidateFail

What it means

PTProvider.MergeAndValidatePrintTicket got an unrecognized or failing HRESULT from the native PTMergeAndValidatePrintTicket call in its switch's default branch and throws PrintQueueException with reason PrintConfig.Provider.MergeValidateFail. This means the merge/validate operation failed for a reason other than conflict or ticket-format errors.

Solutions

  1. Read the HRESULT in the PrintQueueException to identify the native failure.
  2. Verify both tickets target the same printer/driver.
  3. Retry with only the base ticket (null delta) to isolate which ticket triggers the failure.
  4. Restart the Print Spooler service and retry.
  5. Update or reinstall the printer driver.

Example fix

// before
var result = provider.MergeAndValidatePrintTicket(baseTicket, deltaTicket);
// after
try { var result = provider.MergeAndValidatePrintTicket(baseTicket, deltaTicket); }
catch (PrintQueueException ex) {
    var result = provider.MergeAndValidatePrintTicket(baseTicket, null); // isolate
}
Defensive patterns

Strategy: try-catch

Validate before calling

// both tickets must come from the same queue
bool sameDevice = baseTicketSourceQueue == deltaTicketSourceQueue;

Try / catch

try { result = provider.MergeAndValidatePrintTicket(baseTicket, deltaTicket); }
catch (PrintQueueException ex) when (ex.Message.Contains("PrintConfig.Provider.MergeValidateFail"))
{
    // retry with null delta, then restart spooler / update driver
}

Prevention

When it happens

Trigger: Calling PTProvider.MergeAndValidatePrintTicket(baseTicket, deltaTicket) where the native call returns an HRESULT other than success, S_CONFLICT, or E_PRINTTICKET_FORMAT values — e.g. spooler failure or driver provider error.

Common situations: Driver plugin crash during merge; spooler stopped mid-operation; base and delta tickets from different devices; device disconnected from the server during the call.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/PTProvider.cs:322

                        if (PTUtility.IsSuccessCode(hResult))
                        {
                            // convert the success hResult to an enum value
                            switch (hResult)
                            {
                                case (uint)NativeErrorCode.S_PT_CONFLICT_RESOLVED:
                                {
                                    conflictStatus = ConflictStatus.ConflictResolved;
                                    break;
                                }
                                case (uint)NativeErrorCode.S_PT_NO_CONFLICT:
                                {
                                    conflictStatus = ConflictStatus.NoConflict;
                                    break;
                                }
                                default:
                                {
                                    throw new PrintQueueException((int)hResult,
                                                                  "PrintConfig.Provider.MergeValidateFail",
                                                                  _deviceName);
                                }
                            }

                            RewindIStream(validatedPrintTicketStream);
                            
                            return MemoryStreamFromIStream(validatedPrintTicketStream);
                        }

                        if ((hResult == (uint)NativeErrorCode.E_PRINTTICKET_FORMAT) ||
                             (hResult == (uint)NativeErrorCode.E_DELTA_PRINTTICKET_FORMAT))
                        {
                            throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                          "{0} {1} {2}",
                                          PrintSchemaTags.Framework.PrintTicketRoot,
                                          PTUtility.GetTextFromResource("FormatException.XMLNotWellFormed"),
                                          errorMsg),

View on GitHub (pinned to 81131a70a4)