PowerShell/PowerShell · error · NotImplementedException

IsLastTransactionCommitted

Error message

IsLastTransactionCommitted

What it means

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.

Source

Thrown at src/System.Management.Automation/CoreCLR/CorePsStub.cs:84

        /// <remarks>
        /// Always return false in CoreCLR
        /// </remarks>
        internal bool HasTransaction
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Determines if the last transaction has been committed.
        /// </summary>
        internal bool IsLastTransactionCommitted
        {
            get
            {
                throw new NotImplementedException("IsLastTransactionCommitted");
            }
        }

        /// <summary>
        /// Determines if the last transaction has been rolled back.
        /// </summary>
        internal bool IsLastTransactionRolledBack
        {
            get
            {
                throw new NotImplementedException("IsLastTransactionRolledBack");
            }
        }

        /// <summary>
        /// Gets the rollback preference for the active transaction.
        /// </summary>
        internal RollbackSeverity RollbackPreference

View on GitHub (pinned to 3ff3c711bf)

Solutions

  1. Guard with a platform/framework check before accessing transaction APIs (e.g., if (Platform.IsWindows && !Platform.IsCoreCLR)).
  2. Remove transaction-related code paths in CoreCLR builds via compile-time conditionals.
  3. Implement a fallback that treats transactions as always-committed in CoreCLR environments.

Example fix

// before
bool committed = transaction.IsLastTransactionCommitted;

// after
bool committed = true;
#if !CORECLR
committed = transaction.IsLastTransactionCommitted;
#endif
Defensive patterns

Strategy: fallback

Validate before calling

// Guard transaction property access with platform check
bool IsLastTransactionCommittedSafe()
{
#if !CORECLR
    return transaction.IsLastTransactionCommitted;
#else
    return true; // CoreCLR: no transaction support, treat as committed
#endif
}

Try / catch

try { bool committed = transaction.IsLastTransactionCommitted; }
catch [System.NotImplementedException] { committed = true; // CoreCLR fallback: no transactions }

Prevention

When it happens

Trigger: Any code path in PowerShell Core/CoreCLR that accesses the Transaction.IsLastTransactionCommitted property getter. The getter body is `throw new NotImplementedException("IsLastTransactionCommitted")`.

Common situations: 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.

Related errors


AI-assisted analysis of PowerShell/PowerShell@3ff3c711bf (2026-08-13). Data as JSON: /api/errors/3350eb6511c11fc3. Report an issue: GitHub.