Migrating from version 3

edit

Version 4 makes transactions safe by default, reports availability the way a user interface needs it, and checks the state of actions. Update your code as follows:

Version 3Version 4
CreateTransaction(bool isDelayed = true)CreateTransaction(TransactionExecutionMode mode = TransactionExecutionMode.Deferred). isDelayed: true is Deferred, isDelayed: false is Immediate.
Disposing a transaction committed itDisposing rolls it back unless CommitAsync was called. Call await transaction.CommitAsync() before leaving the scope.
Nesting transactions with different isDelayed valuesThrows an InvalidOperationException: a nested transaction uses the mode of the enclosing one.
UndoRedoManager.CommitTransactionAsync() and RollbackTransactionAsync()Removed: they completed the innermost transaction, whichever handle the caller held. Call transaction.CommitAsync() or transaction.RollbackAsync().
CollectionChangedHistoryChanged. UndoRedoManager also implements INotifyPropertyChanged.
CanUndo and CanRedo reported the content of the historiesThey report whether the operation would succeed, so they are false while a transaction is open or an action runs.
UndoRedoActionBase.ExecuteCountIsApplied. Executing an applied action, or reverting an action that is not applied, throws instead of doing nothing.
A canceled CancellationToken was only passed to the actionEvery operation throws an OperationCanceledException before running anything.
A CollectionChanged handler that threw looked like a failure of the operationThe exception is wrapped in an UndoRedoNotificationException, thrown after the operation completed.
Unbounded historyStill the default. Pass maxHistoryDepth to the constructor to bound it.

See Transactions and Undo history in the UI for the details.