dotnet/wpf · error · PrintQueueException
PrintSystemException.PrintQueue.Refresh
Error message
PrintSystemException.PrintQueue.Refresh
What it means
PrintQueue.Refresh wraps a failure while re-reading queue data (including PrepareNameForDownLevelConnectivity for downlevel servers) into a PrintSystemException tagged 'PrintSystemException.PrintQueue.Refresh'. The HResult carries the Win32 error from the underlying spooler call.
Solutions
- Re-resolve the queue via PrintServer.GetPrintQueue(queue.Name) to pick up the current full name, then refresh.
- Verify the printer still exists and the server name is correct before refreshing.
- Check network connectivity to the print server and that the spooler service is running.
- Wrap Refresh in retry/fallback and treat persistent failures as 'queue gone' by re-enumerating queues.
Example fix
// before
queue.Refresh();
// after
try { queue.Refresh(); }
catch (PrintSystemException)
{
queue = server.GetPrintQueue(queue.Name); // re-resolve renamed/recreated queue
queue.Refresh();
} Defensive patterns
Strategy: try-catch
Validate before calling
var current = server.GetPrintQueues().FirstOrDefault(q => q.Name == queue.Name);
if (current == null) throw new InvalidOperationException($"Queue '{queue.Name}' no longer exists"); Try / catch
try { queue.Refresh(); }
catch (PrintSystemException)
{
queue = server.GetPrintQueue(queue.Name); // re-resolve stale/renamed queue
queue.Refresh();
} Prevention
- Re-enumerate queues after printer renames or server maintenance instead of refreshing stale objects.
- Validate network connectivity to the print server in retry logic.
- Use the queue's current FullName from the server, not a cached one.
- Watch spooler service health before bulk Refresh() calls.
When it happens
Trigger: Calling queue.Refresh() when the queue handle cannot be opened under its current FullName/HostingPrintServer — e.g. the printer was renamed, deleted, or the downlevel name mapping fails.
Common situations: Stale PrintQueue reference after printer rename/removal; connecting to a downlevel Windows print server with an unexpected name; offline network share; spooler restarted with the queue recreated under a new name.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- ArgumentException.NonNegativeValue (Parameter 'squareScale')
- ArgumentException.PositiveValue (Parameter 'value')
- ArgumentException.PositiveValue (Parameter 'value')
- errMsg (dynamic: message of caught…
- getPage
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/c47af486dd78861e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintQueue.cpp:3344
if (isBrowsable)
{
ActivateBrowsableQueue();
isBrowsable = false;
}
dataThunkObject = gcnew GetDataThunkObject(this->GetType());
dataThunkObject->PopulatePrintSystemObject(printerThunkHandler,
this,
refreshPropertiesFilter);
//
// Making sure that the Full Name reflects the current name
//
fullQueueName = PrepareNameForDownLevelConnectivity(hostingPrintServer->Name,Name);
}
catch (InternalPrintSystemException^ internalException)
{
throw CreatePrintQueueException(internalException->HResult, "PrintSystemException.PrintQueue.Refresh");
}
__finally
{
delete dataThunkObject;
}
}
/*++
Function Name:
GetAllPropertiesFilter
Description:
The method populates a String Array of all
possible properties of the PrintQueue object.
Parameters:
None
View on GitHub (pinned to 81131a70a4)