-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
InvalidOperationException
in DBM propagation (#6233)
## Summary of changes Now validates whether a `Connection` is `Open` before attempting to issue SQL commands for DBM propagation. Now copies over the `Transaction` field if there is one as we'd throw `InvalidOperationException` Avoids `Npgsql` `NotSupportedException` for DBM. ## Reason for change Many, many errors related to not being in the `Transaction` scope Many, many errors related to `Npgsql` When using `Npgsql` `DbDataSource` (standard in v7.0) the `.Connection` property throws a `NotSupportedException` as the `DbDataSource` type doesn't have "Connections" as you'd normally expect. The exact type that is getting hit here is `NpgsqlDataSourceCommand` https://github.com/npgsql/npgsql/blob/e6c166ba51bc1632498c944981e648fa987b9c12/src/Npgsql/NpgsqlDataSourceCommand.cs#L62 https://www.npgsql.org/doc/basic-usage.html ## Implementation details - Check for connection state - Copy over `Transaction` to created command ## Test coverage - Connection state is pretty difficult to replicate efficiently - any feedback welcome there - Added a `BeginTransaction` in the tests - there were many errors before the fix applied, none afterwards. - Will work on adding a proper sample application for `Npgsql` ## Other details <!-- Fixes #{issue} --> https://datadoghq.atlassian.net/browse/AIDM-434 <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
- Loading branch information
Showing
15 changed files
with
8,957 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.