{"record":{"id":"42a9984f8c5afcc0","repo":"PowerShell/PowerShell","slug":"rollbackpreference","errorCode":null,"errorMessage":"RollbackPreference","messagePattern":"RollbackPreference","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/System.Management.Automation/CoreCLR/CorePsStub.cs","lineNumber":106,"sourceCode":"        /// <summary>\n        /// Determines if the last transaction has been rolled back.\n        /// </summary>\n        internal bool IsLastTransactionRolledBack\n        {\n            get\n            {\n                throw new NotImplementedException(\"IsLastTransactionRolledBack\");\n            }\n        }\n\n        /// <summary>\n        /// Gets the rollback preference for the active transaction.\n        /// </summary>\n        internal RollbackSeverity RollbackPreference\n        {\n            get\n            {\n                throw new NotImplementedException(\"RollbackPreference\");\n            }\n        }\n\n        /// <summary>\n        /// Called by engine APIs to ensure they are protected from\n        /// ambient transactions.\n        /// </summary>\n        /// <remarks>\n        /// Always return null in CoreCLR\n        /// </remarks>\n        internal static IDisposable GetEngineProtectionScope()\n        {\n            return null;\n        }\n\n        /// <summary>\n        /// Aborts the current transaction, no matter how many subscribers are part of it.\n        /// </summary>","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/PowerShell/PowerShell/blob/3ff3c711bf54a18f8440f3c5190c3ac91cdc5852/src/System.Management.Automation/CoreCLR/CorePsStub.cs#L88-L124","documentation":"RollbackPreference is a CoreCLR stub property (RollbackSeverity enum) that always throws NotImplementedException. It is part of the internal Transaction stub class that preserves the full-framework API surface without providing functionality, since System.Transactions is absent from CoreCLR.","triggerScenarios":"Any code path in PowerShell Core/CoreCLR that reads the Transaction.RollbackPreference property getter.","commonSituations":"Transaction-aware cmdlets or modules running on PowerShell 7; code that inspects rollback severity configuration; ported full-framework code that references transaction settings.","solutions":["Guard with a platform/framework check before reading RollbackPreference.","Use compile-time conditionals to exclude transaction-preference reads on CoreCLR.","Default to a sensible RollbackSeverity value (e.g., Error) in CoreCLR fallback code."],"exampleFix":"// before\nvar pref = transaction.RollbackPreference;\n\n// after\nRollbackSeverity pref = RollbackSeverity.Error;\n#if !CORECLR\npref = transaction.RollbackPreference;\n#endif","handlingStrategy":"fallback","validationCode":"// Guard rollback preference access with platform check\nRollbackSeverity GetRollbackPreferenceSafe()\n{\n#if !CORECLR\n    return transaction.RollbackPreference;\n#else\n    return RollbackSeverity.Error; // CoreCLR: default fallback\n#endif\n}","typeGuard":null,"tryCatchPattern":"try { var pref = transaction.RollbackPreference; }\ncatch [System.NotImplementedException] { pref = RollbackSeverity.Error; // CoreCLR fallback }","preventionTips":["Use compile-time conditionals to avoid accessing RollbackPreference on CoreCLR.","Provide a sensible default (e.g., RollbackSeverity.Error) in CoreCLR fallback paths.","Audit code for transaction property access before porting to PowerShell 7."],"tags":["coreclr","transaction","not-implemented","stub","platform","rollback"],"backgroundTag":null,"analyzedSha":"3ff3c711bf54a18f8440f3c5190c3ac91cdc5852","analyzedAt":"2026-08-13T10:39:10.759Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}