FeatureSupport broken when using a wrapped IDbConnection
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Our code uses a "wrapped connection" for APM tracing (inspired by mini profiler), and so this code in FeatureSupport.cs doesn't work:
public static FeatureSupport Get(IDbConnection connection)
{
string name = connection?.GetType().Name;
if (string.Equals(name, "npgsqlconnection", StringComparison.OrdinalIgnoreCase)) return Postgres;
return Default;
}
Essentially, connection is a "TracingDbConnection" that wraps and proxies an underlying "NpgsqlConnection" while sending traces to DataDog (that part isn't of concern here). There doesn't appear to be a way for code outside of Dapper to "correct" this.
It looks like using MiniProfiler has the same issue: https://github.com/MiniProfiler/dotnet/issues/319 (which makes sense, since our approach was inspired by MiniProfiler's)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in FeatureSupport.cs at FeatureSupport.Get(IDbConnection connection), then trace how wrapped connections reach this entry point. Compare the behavior for a direct NpgsqlConnection and the reported TracingDbConnection or MiniProfiler-style wrapper. Done means feature detection works for the wrapped connection without regressing direct connections; the payload does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100