Allow forcing interface duck types to be classes, and update Datadog.Trace.Manual#6082
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 361735 Passed, 2048 Skipped, 15h 35m 38.17s Total Time |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (71ms) : 68, 73
. : milestone, 71,
master - mean (71ms) : 68, 73
. : milestone, 71,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (1,111ms) : 1086, 1136
. : milestone, 1111,
master - mean (1,110ms) : 1087, 1132
. : milestone, 1110,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (110ms) : 107, 113
. : milestone, 110,
master - mean (110ms) : 107, 112
. : milestone, 110,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (772ms) : 756, 789
. : milestone, 772,
master - mean (775ms) : 759, 791
. : milestone, 775,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (94ms) : 90, 97
. : milestone, 94,
master - mean (94ms) : 90, 97
. : milestone, 94,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (735ms) : 719, 752
. : milestone, 735,
master - mean (734ms) : 713, 756
. : milestone, 734,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (191ms) : 187, 196
. : milestone, 191,
master - mean (191ms) : 188, 194
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (1,204ms) : 1181, 1227
. : milestone, 1204,
master - mean (1,199ms) : 1176, 1222
. : milestone, 1199,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (278ms) : 274, 282
. : milestone, 278,
master - mean (277ms) : 272, 282
. : milestone, 277,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (942ms) : 929, 955
. : milestone, 942,
master - mean (941ms) : 920, 962
. : milestone, 941,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6082) - mean (266ms) : 262, 269
. : milestone, 266,
master - mean (266ms) : 263, 270
. : milestone, 266,
section CallTarget+Inlining+NGEN
This PR (6082) - mean (929ms) : 911, 947
. : milestone, 929,
master - mean (930ms) : 910, 951
. : milestone, 930,
|
Benchmarks Report for tracer 🐌Benchmarks for #6082 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.74 KB | 41.48 KB | -259 B | -0.62% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 572μs | 1.39μs | 5.37μs | 0.566 | 0 | 0 | 41.74 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 696μs | 3.58μs | 16μs | 0.342 | 0 | 0 | 41.87 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 890μs | 1.79μs | 6.95μs | 8.56 | 2.57 | 0.428 | 53.29 KB |
| #6082 | WriteAndFlushEnrichedTraces |
net6.0 | 589μs | 1.78μs | 6.89μs | 0.587 | 0 | 0 | 41.48 KB |
| #6082 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 671μs | 3.08μs | 11.9μs | 0.329 | 0 | 0 | 41.72 KB |
| #6082 | WriteAndFlushEnrichedTraces |
net472 | 869μs | 3.3μs | 12.8μs | 8.39 | 2.52 | 0.419 | 53.29 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.18μs | 0.781ns | 3.02ns | 0.0142 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 1.7μs | 2.15ns | 8.34ns | 0.0131 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.09μs | 2.52ns | 9.76ns | 0.156 | 0 | 0 | 987 B |
| #6082 | ExecuteNonQuery |
net6.0 | 1.31μs | 1.3ns | 4.85ns | 0.0143 | 0 | 0 | 1.02 KB |
| #6082 | ExecuteNonQuery |
netcoreapp3.1 | 1.84μs | 1.21ns | 4.68ns | 0.0139 | 0 | 0 | 1.02 KB |
| #6082 | ExecuteNonQuery |
net472 | 2.08μs | 2.43ns | 9.42ns | 0.157 | 0 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6082
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0
1.114
1,218.82
1,358.08
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 | 1.114 | 1,218.82 | 1,358.08 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 1.29μs | 2ns | 7.73ns | 0.0136 | 0 | 0 | 976 B |
| master | CallElasticsearch |
netcoreapp3.1 | 1.56μs | 1.55ns | 5.8ns | 0.0132 | 0 | 0 | 976 B |
| master | CallElasticsearch |
net472 | 2.51μs | 1.38ns | 5.16ns | 0.157 | 0 | 0 | 995 B |
| master | CallElasticsearchAsync |
net6.0 | 1.22μs | 0.773ns | 3ns | 0.0134 | 0 | 0 | 952 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 1.69μs | 0.948ns | 3.42ns | 0.0135 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 2.55μs | 1.92ns | 7.45ns | 0.167 | 0 | 0 | 1.05 KB |
| #6082 | CallElasticsearch |
net6.0 | 1.17μs | 1.06ns | 3.96ns | 0.0135 | 0 | 0 | 976 B |
| #6082 | CallElasticsearch |
netcoreapp3.1 | 1.59μs | 0.821ns | 3.18ns | 0.0135 | 0 | 0 | 976 B |
| #6082 | CallElasticsearch |
net472 | 2.4μs | 2.06ns | 7.96ns | 0.158 | 0 | 0 | 995 B |
| #6082 | CallElasticsearchAsync |
net6.0 | 1.36μs | 1.44ns | 5.56ns | 0.0136 | 0 | 0 | 952 B |
| #6082 | CallElasticsearchAsync |
netcoreapp3.1 | 1.66μs | 0.989ns | 3.7ns | 0.0133 | 0 | 0 | 1.02 KB |
| #6082 | CallElasticsearchAsync |
net472 | 2.59μs | 1.95ns | 7.29ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.29μs | 1.23ns | 4.77ns | 0.013 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 1.63μs | 0.769ns | 2.98ns | 0.0123 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 1.78μs | 0.652ns | 2.44ns | 0.145 | 0 | 0 | 915 B |
| #6082 | ExecuteAsync |
net6.0 | 1.23μs | 1.38ns | 5.18ns | 0.013 | 0 | 0 | 952 B |
| #6082 | ExecuteAsync |
netcoreapp3.1 | 1.61μs | 0.657ns | 2.46ns | 0.0129 | 0 | 0 | 952 B |
| #6082 | ExecuteAsync |
net472 | 1.84μs | 0.942ns | 3.65ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 4.04μs | 2.6ns | 9.72ns | 0.0305 | 0 | 0 | 2.22 KB |
| master | SendAsync |
netcoreapp3.1 | 5.11μs | 2.88ns | 11.2ns | 0.0383 | 0 | 0 | 2.76 KB |
| master | SendAsync |
net472 | 7.77μs | 2.52ns | 9.42ns | 0.498 | 0 | 0 | 3.15 KB |
| #6082 | SendAsync |
net6.0 | 4.32μs | 3.38ns | 13.1ns | 0.0303 | 0 | 0 | 2.22 KB |
| #6082 | SendAsync |
netcoreapp3.1 | 5.14μs | 2.26ns | 8.46ns | 0.036 | 0 | 0 | 2.76 KB |
| #6082 | SendAsync |
net472 | 7.75μs | 4.29ns | 16.6ns | 0.496 | 0 | 0 | 3.15 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 1.43μs | 0.854ns | 3.19ns | 0.023 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
netcoreapp3.1 | 2.1μs | 0.719ns | 2.69ns | 0.0221 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
net472 | 2.66μs | 2.42ns | 9.39ns | 0.249 | 0 | 0 | 1.57 KB |
| #6082 | EnrichedLog |
net6.0 | 1.54μs | 0.832ns | 3.11ns | 0.0225 | 0 | 0 | 1.64 KB |
| #6082 | EnrichedLog |
netcoreapp3.1 | 2.15μs | 0.765ns | 2.86ns | 0.0224 | 0 | 0 | 1.64 KB |
| #6082 | EnrichedLog |
net472 | 2.57μs | 0.769ns | 2.88ns | 0.249 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 115μs | 281ns | 1.09μs | 0.0581 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
netcoreapp3.1 | 119μs | 178ns | 690ns | 0.0607 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
net472 | 146μs | 186ns | 721ns | 0.658 | 0.219 | 0 | 4.46 KB |
| #6082 | EnrichedLog |
net6.0 | 113μs | 169ns | 653ns | 0.0566 | 0 | 0 | 4.28 KB |
| #6082 | EnrichedLog |
netcoreapp3.1 | 117μs | 185ns | 716ns | 0.0583 | 0 | 0 | 4.28 KB |
| #6082 | EnrichedLog |
net472 | 147μs | 44.2ns | 171ns | 0.662 | 0.221 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 3.01μs | 3.93ns | 15.2ns | 0.03 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
netcoreapp3.1 | 4.27μs | 4.3ns | 16.7ns | 0.0288 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
net472 | 5μs | 1.81ns | 7ns | 0.321 | 0 | 0 | 2.02 KB |
| #6082 | EnrichedLog |
net6.0 | 3.04μs | 1.4ns | 5.42ns | 0.0305 | 0 | 0 | 2.2 KB |
| #6082 | EnrichedLog |
netcoreapp3.1 | 4.14μs | 1.76ns | 6.82ns | 0.0288 | 0 | 0 | 2.2 KB |
| #6082 | EnrichedLog |
net472 | 4.89μs | 1.17ns | 4.52ns | 0.319 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net6.0 | 1.37μs | 0.597ns | 2.31ns | 0.0157 | 0 | 0 | 1.14 KB |
| master | SendReceive |
netcoreapp3.1 | 1.78μs | 1.8ns | 6.97ns | 0.0151 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.09μs | 1.01ns | 3.92ns | 0.183 | 0 | 0 | 1.16 KB |
| #6082 | SendReceive |
net6.0 | 1.4μs | 0.543ns | 1.96ns | 0.0158 | 0 | 0 | 1.14 KB |
| #6082 | SendReceive |
netcoreapp3.1 | 1.75μs | 2.18ns | 8.44ns | 0.0149 | 0 | 0 | 1.14 KB |
| #6082 | SendReceive |
net472 | 2.01μs | 0.866ns | 3.35ns | 0.184 | 0.001 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 2.69μs | 1ns | 3.89ns | 0.0216 | 0 | 0 | 1.6 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.96μs | 2.05ns | 7.95ns | 0.0217 | 0 | 0 | 1.65 KB |
| master | EnrichedLog |
net472 | 4.33μs | 5.28ns | 19.7ns | 0.323 | 0 | 0 | 2.04 KB |
| #6082 | EnrichedLog |
net6.0 | 2.84μs | 2.21ns | 8.58ns | 0.0227 | 0 | 0 | 1.6 KB |
| #6082 | EnrichedLog |
netcoreapp3.1 | 3.91μs | 2.91ns | 10.9ns | 0.0213 | 0 | 0 | 1.65 KB |
| #6082 | EnrichedLog |
net472 | 4.43μs | 3.1ns | 11.6ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6082
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.168
647.43
554.48
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.168 | 647.43 | 554.48 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 405ns | 0.218ns | 0.843ns | 0.00807 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 644ns | 1.76ns | 6.81ns | 0.00771 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 653ns | 0.901ns | 3.49ns | 0.0915 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 501ns | 0.329ns | 1.27ns | 0.00985 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 659ns | 0.826ns | 3.2ns | 0.00942 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 867ns | 0.923ns | 3.58ns | 0.104 | 0 | 0 | 658 B |
| #6082 | StartFinishSpan |
net6.0 | 419ns | 0.104ns | 0.39ns | 0.00822 | 0 | 0 | 576 B |
| #6082 | StartFinishSpan |
netcoreapp3.1 | 555ns | 0.44ns | 1.7ns | 0.00782 | 0 | 0 | 576 B |
| #6082 | StartFinishSpan |
net472 | 608ns | 0.687ns | 2.66ns | 0.0915 | 0 | 0 | 578 B |
| #6082 | StartFinishScope |
net6.0 | 480ns | 0.135ns | 0.506ns | 0.00987 | 0 | 0 | 696 B |
| #6082 | StartFinishScope |
netcoreapp3.1 | 693ns | 0.386ns | 1.44ns | 0.00966 | 0 | 0 | 696 B |
| #6082 | StartFinishScope |
net472 | 885ns | 0.278ns | 1.08ns | 0.105 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 672ns | 0.712ns | 2.76ns | 0.00975 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 929ns | 0.647ns | 2.42ns | 0.00919 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.15μs | 0.938ns | 3.63ns | 0.104 | 0 | 0 | 658 B |
| #6082 | RunOnMethodBegin |
net6.0 | 643ns | 0.279ns | 1.08ns | 0.00968 | 0 | 0 | 696 B |
| #6082 | RunOnMethodBegin |
netcoreapp3.1 | 987ns | 1.48ns | 5.74ns | 0.0094 | 0 | 0 | 696 B |
| #6082 | RunOnMethodBegin |
net472 | 1.08μs | 0.291ns | 1.13ns | 0.104 | 0 | 0 | 658 B |
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6082) (11.078M) : 0, 11078012
master (11.017M) : 0, 11017205
benchmarks/2.9.0 (11.081M) : 0, 11080577
section Automatic
This PR (6082) (7.251M) : 0, 7250671
master (7.345M) : 0, 7345268
benchmarks/2.9.0 (7.732M) : 0, 7732233
section Trace stats
master (7.686M) : 0, 7685937
section Manual
master (11.282M) : 0, 11281844
section Manual + Automatic
This PR (6082) (6.821M) : 0, 6821050
master (6.787M) : 0, 6787430
section DD_TRACE_ENABLED=0
master (10.309M) : 0, 10308950
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6082) (9.537M) : 0, 9537113
master (9.597M) : 0, 9597372
benchmarks/2.9.0 (9.798M) : 0, 9798067
section Automatic
This PR (6082) (6.617M) : 0, 6616958
master (6.539M) : 0, 6539006
section Trace stats
master (6.749M) : 0, 6748772
section Manual
master (9.845M) : 0, 9844668
section Manual + Automatic
This PR (6082) (6.040M) : 0, 6040288
master (6.069M) : 0, 6068685
section DD_TRACE_ENABLED=0
master (8.828M) : 0, 8828499
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6082) (10.203M) : 0, 10203148
master (10.226M) : 0, 10226487
benchmarks/2.9.0 (10.067M) : 0, 10067315
section Automatic
This PR (6082) (6.803M) : 0, 6802505
master (6.845M) : 0, 6844955
benchmarks/2.9.0 (7.552M) : 0, 7552193
section Trace stats
master (7.397M) : 0, 7397422
section Manual
master (10.131M) : 0, 10131036
section Manual + Automatic
This PR (6082) (6.313M) : 0, 6313176
master (6.212M) : 0, 6212137
section DD_TRACE_ENABLED=0
master (9.578M) : 0, 9578468
|
Summary of changes
Reason for change
In #6073, a customer was using the return type of manual instrumentation (
IScope) in an expression (as part of Lamar's IoC implementation). This was causing an error in the expression:Ultimately, it's because
Expression.Call()invokesTypeUtils.AreReferenceAssignable()which always returnfalsefor struct types: https://github.com/dotnet/runtime/blob/cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L851We can confirm this using:
A minimal repro (when auto instrumentation is enabled) looks like this:
This behaviour seems weird, but the only obvious solution to it is to use classes instead of structs for our proxies in cases where we're publicly exposing the proxies.
Overall, this shouldn't have any actual impact on performance; we're returning
IScopeetc anyway, which requires boxing our duck types.Implementation details
Add a
[DuckAsClass]attribute that can only be applied to interfaces. TheDuckTypeclass checks for this attribute (or a similarly named attribute) when creating the proxy, and uses a class-based proxy if required.Subsequently added the
[DuckAsClass]to the following interfaces (all the public interfaces) in the Datadog.Trace.Manual project:ITestITestModuleITestSessionITestSuiteIScopeISpanISpanContextThis isn't used from duck typing so doesn't need itITracerTest coverage
[DuckAsClass]attribute.Other details
Fixes #6073