{"record":{"id":"f82c372d987a82de","repo":"dotnet/wpf","slug":"printsystemexception-printserver-minorversioncannotchange","errorCode":null,"errorMessage":"PrintSystemException.PrintServer.MinorVersionCannotChange","messagePattern":"PrintSystemException\\.PrintServer\\.MinorVersionCannotChange","errorType":"exception","errorClass":"PrintServerException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintServer.cpp","lineNumber":2062,"sourceCode":"\n    None\n\n--*/\nvoid\nPrintServer::MinorVersion::\nset(\n    Int32  version\n    )\n{\n    VerifyAccess();\n\n    if (PropertiesCollection->GetProperty(\"MinorVersion\")->IsInternallyInitialized)\n    {\n        minorVersion = version;\n    }\n    else\n    {\n        throw CreatePrintServerException(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED),\n                                         \"PrintSystemException.PrintServer.MinorVersionCannotChange\"\n                                         );\n\n    }\n}\n\n/*++\n\nRoutine Name:\n\n    get_RestartJobOnPoolTimeout\n\nRoutine Description:\n\n    Property\n\nArguments:\n","sourceCodeStart":2044,"sourceCodeEnd":2080,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/PrintServer.cpp#L2044-L2080","documentation":"The PrintServer.MinorVersion setter mirrors MajorVersion: it only assigns when the MinorVersion property was internally initialized from the server; otherwise it throws PrintSystemException (ERROR_NOT_SUPPORTED) keyed 'PrintSystemException.PrintServer.MinorVersionCannotChange'. Minor version is server-managed and cannot be changed by user code.","triggerScenarios":"Assigning to PrintServer.MinorVersion when the property was not populated internally by the spooler (e.g. freshly constructed server object).","commonSituations":"Code mirroring server settings between PrintServer instances; attempting to simulate a different server version; refactoring that writes all properties.","solutions":["Remove any assignment to MinorVersion; treat it as read-only","If version-dependent logic is required, branch on the value instead of changing it","Wrap writes in try-catch only as a migration guard while removing the write"],"exampleFix":"// before\nserver.MinorVersion = 0; // throws\n// after\nif (server.MinorVersion < 3) { Console.WriteLine(\"Legacy server detected\"); } // read-only check","handlingStrategy":"validation","validationCode":"if (propertyWriteTargetsMinorVersion) throw new InvalidOperationException(\"MinorVersion is read-only\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat PrintServer.MinorVersion as read-only","Exclude server metadata fields from generic property-copy code","Branch on version values instead of attempting to change them"],"tags":["printing","print-server","unsupported-operation","version"],"backgroundTag":"unsupported-operation","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"}