[CSHARP-2339] Disposing client session after transaction commit throws exception Created: 25/Jul/18 Updated: 28/Oct/23 Resolved: 26/Jul/18 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Session Management, Write Operations |
| Affects Version/s: | 2.7.0 |
| Fix Version/s: | 2.7.1 |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | Wouter De Keersmaecker | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10, C#, server version 4.0 |
||
| Description |
|
The following snippet of code throws an InvalidOperationException with message "Cannot call AbortTransaction after calling CommitTransaction."
The exception is thrown on disposal of the client session, and upon closer inspection I found the following: Dispose() of CoreSession:
In the Dispose function, a check is made to see if there is any transaction and if so it is aborted. However, after creating and commiting a transaction, _currentTransaction is not null but its state is "Committed". Could it be that a check for the state of _currentTransaction is missing, or am I using it wrong?
|
| Comments |
| Comment by Githook User [ 06/Nov/18 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 26/Jul/18 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Wouter De Keersmaecker [ 25/Jul/18 ] |
|
Ah yes, I forgot I have first chance exceptions enabled in Visual Studio. |
| Comment by Robert Stam [ 25/Jul/18 ] |
|
I can reproduce this, but it turns out this exception is being ignored (as you can see in the code snippet you included from CoreSession). Still, we should not be throwing this exception at all. |