dotnet/wpf · error · PrintServerException
PrintSystemException.PrintServer.Commit
Error message
PrintSystemException.PrintServer.Commit
What it means
PrintServer.Commit persists altered properties to the spooler. If the native ComitDirtyData call fails with an InternalPrintSystemException, the HRESULT is re-thrown as PrintSystemException keyed 'PrintSystemException.PrintServer.Commit'. It means committing the server's dirty (changed) settings to the print server failed.
Solutions
- Ensure the process runs elevated / with print-server admin rights
- Only set properties that are writable (check IsInternallyInitialized / altered filter)
- Check HResult for the specific Win32 failure
- Call Refresh before re-committing to resync with the server
Example fix
// before
server.BeepEnabled = true;
server.Commit();
// after
if (WindowsIdentity.GetCurrent().Owner.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid))
{
server.BeepEnabled = true;
server.Commit();
} Defensive patterns
Strategy: try-catch
Validate before calling
var admin = new WindowsPrincipal(WindowsIdentity.GetCurrent());
if (!admin.IsInRole(WindowsBuiltInRole.Administrator))
throw new UnauthorizedAccessException("Commit requires admin rights"); Type guard
static bool CanCommit(PrintServer s) =>
s != null && new WindowsPrincipal(WindowsIdentity.GetCurrent())
.IsInRole(WindowsBuiltInRole.Administrator); Try / catch
try { server.Commit(); }
catch (PrintSystemException ex)
{ Log.Error($"Commit failed 0x{ex.HResult:X}"); server.Refresh(); throw; } Prevention
- Only change writable properties
- Run elevated when changing server settings
- Call Refresh before re-committing after a failure
- Batch property changes into a single Commit
When it happens
Trigger: Calling PrintServer.Commit after mutating properties (e.g. via InstallPrintQueue or property setters) when the spooler rejects the change.
Common situations: Read-only property changed; insufficient admin rights to change server settings; remote server refuses configuration changes; spooler error writing configuration.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- PrintSystemException.PrintServer.Commit
- PrintSystemException.PrintQueue.Pause
- PrintSystemException.PrintQueue.Purge
- PrintSystemException.PrintServer.Generic
- PrintSystemException.PrintServer.MajorVersionCannotChange
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/1dd1d5d04949c904.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintServer.cpp:1089
void
--*/
void
PrintServer::
Commit(
void
)
{
VerifyAccess();
try
{
ComitDirtyData(GetAlteredPropertiesFilter());
}
catch (InternalPrintSystemException^ internalException)
{
throw CreatePrintServerException(internalException->HResult, "PrintSystemException.PrintServer.Commit");
}
}
/*++
Routine Name:
Refresh
Routine Description:
Refreshes the object attributes.
Arguments:
None
Return Value:View on GitHub (pinned to 81131a70a4)