{"record":{"id":"3350eb6511c11fc3","repo":"PowerShell/PowerShell","slug":"islasttransactioncommitted","errorCode":null,"errorMessage":"IsLastTransactionCommitted","messagePattern":"IsLastTransactionCommitted","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/System.Management.Automation/CoreCLR/CorePsStub.cs","lineNumber":84,"sourceCode":"        /// <remarks>\n        /// Always return false in CoreCLR\n        /// </remarks>\n        internal bool HasTransaction\n        {\n            get\n            {\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Determines if the last transaction has been committed.\n        /// </summary>\n        internal bool IsLastTransactionCommitted\n        {\n            get\n            {\n                throw new NotImplementedException(\"IsLastTransactionCommitted\");\n            }\n        }\n\n        /// <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","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/PowerShell/PowerShell/blob/3ff3c711bf54a18f8440f3c5190c3ac91cdc5852/src/System.Management.Automation/CoreCLR/CorePsStub.cs#L66-L102","documentation":"IsLastTransactionCommitted is a CoreCLR stub property that always throws NotImplementedException. Transactions (System.Transactions) are a Windows-only feature not available in .NET Core/CoreCLR. This property exists solely to maintain API surface compatibility with full-framework PowerShell's internal Transaction class; it is never functional on CoreCLR.","triggerScenarios":"Any code path in PowerShell Core/CoreCLR that accesses the Transaction.IsLastTransactionCommitted property getter. The getter body is `throw new NotImplementedException(\"IsLastTransactionCommitted\")`.","commonSituations":"Running full-framework PowerShell modules on PowerShell 7 that check transaction state; cmdlets with transaction support that are invoked on a non-Windows or CoreCLR host; code that unconditionally checks transaction properties.","solutions":["Guard with a platform/framework check before accessing transaction APIs (e.g., if (Platform.IsWindows && !Platform.IsCoreCLR)).","Remove transaction-related code paths in CoreCLR builds via compile-time conditionals.","Implement a fallback that treats transactions as always-committed in CoreCLR environments."],"exampleFix":"// before\nbool committed = transaction.IsLastTransactionCommitted;\n\n// after\nbool committed = true;\n#if !CORECLR\ncommitted = transaction.IsLastTransactionCommitted;\n#endif","handlingStrategy":"fallback","validationCode":"// Guard transaction property access with platform check\nbool IsLastTransactionCommittedSafe()\n{\n#if !CORECLR\n    return transaction.IsLastTransactionCommitted;\n#else\n    return true; // CoreCLR: no transaction support, treat as committed\n#endif\n}","typeGuard":null,"tryCatchPattern":"try { bool committed = transaction.IsLastTransactionCommitted; }\ncatch [System.NotImplementedException] { committed = true; // CoreCLR fallback: no transactions }","preventionTips":["Guard all transaction API access with #if !CORECLR or Platform.IsWindows checks.","Do not rely on transaction state in CoreCLR — design cmdlets to be transaction-agnostic on that platform.","Use compile-time conditionals to exclude transaction code paths entirely in CoreCLR builds."],"tags":["coreclr","transaction","not-implemented","stub","platform","windows-only"],"backgroundTag":null,"analyzedSha":"3ff3c711bf54a18f8440f3c5190c3ac91cdc5852","analyzedAt":"2026-08-13T10:39:10.759Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}