-
Notifications
You must be signed in to change notification settings - Fork 342
The transaction associated with this command is not the connection's active transaction #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a result of fixing #389, which exposed the underlying strictness of MySqlConnector with regards to transactions (see #333 and https://bugs.mysql.com/bug.php?id=88611 where Connector/NET's default behaviour is reported as a bug).
The fix is fairly simple: if you want a Dapper query to participate in a connection, explicitly denote that intent:
|
Damn, that's unfortunate. I always expected queries executed to be within the started transaction for that connection. Would it be possible to somehow automate having a single transaction per connection? |
It's an unfortunate mismatch between database servers' actual implementations (which typically have an active transaction as a "global" connection-level property) and ADO.NET, which allows The behaviour of ADO.NET is not very well specified in this situation, and the various providers choose to implement it differently. In this case, (for now) I've deliberately chosen to make a breaking change from Connector/NET in order to proactively catch potential bugs (see links in my first reply). |
For future reference, you can also opt in to the Connector/NET behaviour by adding |
I just updated from 0.29.1 to 0.32.0 and I'm not sure if this issue is a bug in my code or not. I can't see any obvious issue on my end. Dapper was also updated from
1.50.4-alpha1-00070
to1.50.4
Code block that is starting the connection:
https://github.com/SteamDatabase/SteamDatabaseBackend/blob/e6953ba6a20bb89fe4abe25f2fee1f663c3057d3/Processors/DepotProcessor.cs#L626-L632
And then it throws on the very first call to
QueryAsync
on the same database connection inProcessDepotAfterDownload
.Full stack trace:
The text was updated successfully, but these errors were encountered: