stride3d/stride · error · InvalidOperationException
Trying to complete a selection transaction but no…
Error message
Trying to complete a selection transaction but no transaction in progress
What it means
CompleteTransaction is the private commit step of a selection transaction; it throws InvalidOperationException when currentTransaction is null, meaning something asked to complete a transaction that was never begun or was already completed.
Solutions
- Ensure BeginTransaction is called exactly once per CompleteTransaction
- Guard the completion path (check currentTransaction != null) or make complete idempotent
- Track transaction state so teardown cannot complete an already-finished transaction
Example fix
// before
private void CompleteTransaction()
{
var newState = new SelectionState();
// after
private void CompleteTransaction()
{
if (currentTransaction == null) return; // nothing to complete
var newState = new SelectionState(); Defensive patterns
Strategy: try-catch
Validate before calling
if (currentTransaction == null) return; // no active transaction to complete
Type guard
bool HasActiveTransaction => currentTransaction != null;
Try / catch
try { CompleteTransaction(); } catch (InvalidOperationException ex) when (ex.Message.Contains("no transaction in progress")) { /* tolerate double-complete during teardown */ } Prevention
- Pair Begin/CompleteTransaction strictly in begin/finally blocks
- Add a transaction-depth counter to prevent nested or double completion
- Cancel (rather than complete) on exception paths that abort the transaction
When it happens
Trigger: Calling the completion path with no BeginTransaction — e.g. transaction already completed (double completion), an exception during the transaction skipped the begin, or nested completion after the current transaction was closed.
Common situations: Re-entrant selection updates completing the same transaction twice; exception in the middle of a transaction followed by a finally/complete call; UI events firing after the transaction ended.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- A dependency object must be attached in order to register a…
- A dependency object must be attached in order to unregister…
- A disposed operation cannot be rollbacked.
- A disposed operation cannot be rollforwarded.
- A serializer factory selector must be sealed before being…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/0138f700a5f6e5ca.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Core.Assets.Editor/Services/SelectionService.cs:197
{
foreach (var collection in scope.Collections)
{
var descriptor = TypeDescriptorFactory.Default.Find(collection.GetType()) as CollectionDescriptor;
descriptor?.Clear(collection);
}
}
}
finally
{
PropertySelectionSuppressed = false;
}
}
}
private void CompleteTransaction()
{
if (currentTransaction == null)
throw new InvalidOperationException("Trying to complete a selection transaction but no transaction in progress");
var newState = new SelectionState();
newState.SaveStates(scopes);
currentTransaction.Continue();
stack.PushOperation(new SelectionOperation(this, CurrentState, newState));
currentTransaction.Complete();
currentTransaction = null;
CurrentState = newState;
}
}
}
View on GitHub (pinned to 96fad776d2)