dotnet/wpf · error · PrintQueueException
PrintConfig.Provider.BindFail
PrintConfig.Provider.BindFail
Error message
PrintConfig.Provider.BindFail
What it means
PTProvider's constructor calls the native PTOpenProviderEx and checks the returned HRESULT; when it is not a success code, it throws PrintQueueException with reason PrintConfig.Provider.BindFail. This means the managed print ticket provider could not bind to the unmanaged print ticket provider for the given device and schema version.
Solutions
- Verify the printer driver supports Print Schema (XPSDrv / Vista+ class driver); switch to an XPSDrv-capable driver.
- Ensure the Print Spooler service is running (net start spooler).
- Confirm serverName and deviceName resolve to an existing queue; test with a local queue.
- Check that the requested schema version is supported by the driver's PT provider.
- Catch PrintQueueException and inspect the embedded HRESULT for the native failure code.
Example fix
// before
var provider = new PTProvider("OldPS Printer", clientVersion, serverName); // driver has no PT provider
// after
var queue = new PrintQueue(new PrintServer(serverName), "Microsoft XPS Document Writer");
var provider = new PTProvider(queue.FullName, clientVersion, serverName); Defensive patterns
Strategy: try-catch
Validate before calling
using var spooler = new ServiceController("Spooler");
if (spooler.Status != ServiceControllerStatus.Running)
throw new InvalidOperationException("Print Spooler is not running.");
bool exists = new PrintServer().GetPrintQueues().Any(q => q.FullName == deviceName); Type guard
static bool CanBind(string deviceName, PrintServer server) =>
!string.IsNullOrWhiteSpace(deviceName) &&
server.GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections })
.Any(q => q.FullName == deviceName); Try / catch
try { provider = new PTProvider(deviceName, clientVersion, serverName); }
catch (PrintQueueException ex) when (ex.Message.Contains("PrintConfig.Provider.BindFail"))
{
// inspect ex.HResult; fall back to managed PrintQueue.GetPrintCapabilities path
} Prevention
- Ensure the Print Spooler service is running before binding.
- Use XPSDrv-capable drivers when print ticket support is required.
- Resolve device names from PrintServer enumeration rather than user input.
When it happens
Trigger: new PTProvider(deviceName, clientVersion, serverName) where PTOpenProviderEx returns a failure HRESULT: driver without a print ticket provider DLL, wrong schema clientVersion, print spooler not running, or unreachable print server.
Common situations: Targeting a driver that predates PrintTicket support (pre-Vista drivers); downgraded/uninstalled driver; spooler (Spooler service) stopped; connecting to a remote print server that rejects the call; session-isolated drivers under RDP.
Related errors
- PrintConfig.Provider.DevMode2PTFail
- PrintConfig.Provider.GetPrintCapFail
- PrintConfig.Provider.MergeValidateFail
- PrintConfig.Provider.PT2DevModeFail
- PrintSystemException.PrintQueue.Generic
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/d8e719af002412da.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/PTProvider.cs:165
/// Printing components are not installed on the client
/// </exception>
public PTProvider(string deviceName, int maxVersion, int clientVersion)
{
Toolbox.EmitEvent(EventTrace.Event.WClientDRXPTProviderStart);
// We are not doing late binding to the device here because we should
// indicate right away if there was an error in binding the provider
// to the device. Doing late binding would mean that any instance
// method could throw a no such printer exception.
uint hResult = UnsafeNativeMethods.PTOpenProviderEx(deviceName,
maxVersion,
clientVersion,
out _providerHandle,
out _schemaVersion);
if (!PTUtility.IsSuccessCode(hResult))
{
throw new PrintQueueException((int)hResult, "PrintConfig.Provider.BindFail", deviceName);
}
#if _DEBUG
if (_schemaVersion != clientVersion)
{
// PTOpenProviderEx() shouldn't succeed if it can't support the requested version.
throw new InvalidOperationException("_DEBUG: Client requested Print Schema version " +
clientVersion.ToString(CultureInfo.CurrentCulture) +
" doesn't match to provider Print Schema version " +
_schemaVersion.ToString(CultureInfo.CurrentCulture));
}
#endif
// If succeeded, PTOpenProviderEx() function should ensure that a valid _providerHandle
// is returned and the returned schemaVersion is within valid range (i.e. no greater than maxVersion)
this._deviceName = deviceName;
this._thread = Thread.CurrentThread;View on GitHub (pinned to 81131a70a4)