Skip to content

[Dynamic Instrumentation] DEBUG-4758 Fix type mismatch with @duration expression#7844

Merged
dudikeleti merged 3 commits intomasterfrom
dudik/el/fix-duration-error
Dec 29, 2025
Merged

[Dynamic Instrumentation] DEBUG-4758 Fix type mismatch with @duration expression#7844
dudikeleti merged 3 commits intomasterfrom
dudik/el/fix-duration-error

Conversation

@dudikeleti
Copy link
Contributor

@dudikeleti dudikeleti commented Nov 19, 2025

Summary of changes

Fixes a bug in the debugger expression parser when compiling expressions with T == object that return value types (e.g. @duration as TimeSpan), causing a runtime error (“Expression of type 'System.TimeSpan' cannot be used for assignment to type 'System.Object'”).

Test coverage

ProbeExpressionParser_ObjectReturnType_AllowsValueTypeResults

@dudikeleti dudikeleti marked this pull request as ready for review November 19, 2025 16:10
@dudikeleti dudikeleti requested a review from a team as a code owner November 19, 2025 16:10
@datadog-datadog-prod-us1

This comment has been minimized.

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Nov 19, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7844) and master.

⚠️ Potential regressions detected

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration68.30 ± (68.39 - 68.61) ms74.25 ± (74.24 - 74.57) ms+8.7%❌⬆️
.NET Framework 4.8 - Bailout
duration72.18 ± (72.13 - 72.34) ms79.23 ± (79.18 - 79.54) ms+9.8%❌⬆️
Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration68.30 ± (68.39 - 68.61) ms74.25 ± (74.24 - 74.57) ms+8.7%❌⬆️
.NET Framework 4.8 - Bailout
duration72.18 ± (72.13 - 72.34) ms79.23 ± (79.18 - 79.54) ms+9.8%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1003.41 ± (1004.79 - 1010.88) ms1056.93 ± (1058.58 - 1067.09) ms+5.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.14 ± (22.10 - 22.19) ms23.12 ± (23.07 - 23.17) ms+4.4%✅⬆️
process.time_to_main_ms78.91 ± (78.75 - 79.08) ms87.61 ± (87.38 - 87.84) ms+11.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.94 - 10.95) MB10.91 ± (10.91 - 10.92) MB-0.3%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms21.94 ± (21.91 - 21.96) ms22.93 ± (22.90 - 22.97) ms+4.5%✅⬆️
process.time_to_main_ms79.81 ± (79.73 - 79.89) ms88.58 ± (88.34 - 88.82) ms+11.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.95 - 10.96) MB10.94 ± (10.94 - 10.95) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms245.11 ± (241.07 - 249.15) ms256.24 ± (251.66 - 260.83) ms+4.5%✅⬆️
process.time_to_main_ms470.63 ± (470.14 - 471.12) ms501.33 ± (500.57 - 502.09) ms+6.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.14 ± (48.11 - 48.16) MB48.15 ± (48.13 - 48.18) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 6 - Baseline
process.internal_duration_ms20.67 ± (20.64 - 20.70) ms21.61 ± (21.56 - 21.65) ms+4.5%✅⬆️
process.time_to_main_ms68.08 ± (67.97 - 68.19) ms75.26 ± (75.10 - 75.43) ms+10.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.59 - 10.60) MB10.65 ± (10.65 - 10.65) MB+0.5%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.49 ± (20.46 - 20.51) ms21.55 ± (21.51 - 21.59) ms+5.2%✅⬆️
process.time_to_main_ms68.79 ± (68.73 - 68.86) ms76.05 ± (75.88 - 76.23) ms+10.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.65 - 10.66) MB10.74 ± (10.74 - 10.75) MB+0.9%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms244.96 ± (242.99 - 246.93) ms256.96 ± (254.18 - 259.73) ms+4.9%✅⬆️
process.time_to_main_ms440.78 ± (440.27 - 441.30) ms467.25 ± (466.60 - 467.90) ms+6.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.65 ± (48.62 - 48.68) MB48.51 ± (48.49 - 48.53) MB-0.3%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms18.74 ± (18.71 - 18.77) ms19.79 ± (19.75 - 19.83) ms+5.6%✅⬆️
process.time_to_main_ms66.85 ± (66.74 - 66.97) ms74.80 ± (74.65 - 74.95) ms+11.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.68 - 7.70) MB7.70 ± (7.69 - 7.70) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms18.78 ± (18.76 - 18.80) ms19.90 ± (19.85 - 19.95) ms+6.0%✅⬆️
process.time_to_main_ms68.03 ± (67.97 - 68.08) ms76.31 ± (76.14 - 76.49) ms+12.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.73) MB7.73 ± (7.72 - 7.74) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms178.16 ± (177.12 - 179.21) ms192.77 ± (191.97 - 193.57) ms+8.2%✅⬆️
process.time_to_main_ms425.03 ± (424.32 - 425.75) ms457.22 ± (456.48 - 457.95) ms+7.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.34 ± (36.32 - 36.37) MB36.57 ± (36.53 - 36.61) MB+0.6%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.4%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration191.61 ± (191.40 - 192.28) ms192.06 ± (191.99 - 192.74) ms+0.2%✅⬆️
.NET Framework 4.8 - Bailout
duration195.27 ± (194.91 - 195.41) ms195.24 ± (195.12 - 195.74) ms-0.0%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1098.77 ± (1100.94 - 1108.15) ms1103.08 ± (1104.63 - 1111.44) ms+0.4%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms186.56 ± (186.25 - 186.86) ms186.28 ± (185.93 - 186.63) ms-0.1%
process.time_to_main_ms79.83 ± (79.64 - 80.02) ms80.26 ± (80.07 - 80.45) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.06 ± (16.03 - 16.09) MB16.19 ± (16.17 - 16.22) MB+0.8%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.6%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms185.65 ± (185.38 - 185.92) ms186.35 ± (186.03 - 186.67) ms+0.4%✅⬆️
process.time_to_main_ms81.34 ± (81.20 - 81.48) ms81.53 ± (81.42 - 81.63) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.10 ± (16.03 - 16.16) MB16.22 ± (16.17 - 16.27) MB+0.7%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (20 - 21)+0.2%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms426.97 ± (424.26 - 429.68) ms419.77 ± (416.56 - 422.98) ms-1.7%
process.time_to_main_ms470.56 ± (470.13 - 470.99) ms472.21 ± (471.66 - 472.76) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.58 ± (58.46 - 58.69) MB58.77 ± (58.65 - 58.89) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 30)29 ± (29 - 30)-0.0%
.NET 6 - Baseline
process.internal_duration_ms190.52 ± (190.22 - 190.81) ms203.30 ± (202.91 - 203.70) ms+6.7%✅⬆️
process.time_to_main_ms69.39 ± (69.25 - 69.53) ms74.68 ± (74.38 - 74.98) ms+7.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.87 ± (15.70 - 16.04) MB16.28 ± (16.25 - 16.31) MB+2.6%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (19 - 19)+7.6%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms189.85 ± (189.54 - 190.16) ms203.60 ± (203.30 - 203.89) ms+7.2%✅⬆️
process.time_to_main_ms70.38 ± (70.28 - 70.48) ms75.99 ± (75.84 - 76.15) ms+8.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.93 ± (15.76 - 16.09) MB16.31 ± (16.29 - 16.34) MB+2.4%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (20 - 20)+7.0%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms453.23 ± (451.27 - 455.19) ms470.59 ± (467.65 - 473.53) ms+3.8%✅⬆️
process.time_to_main_ms442.42 ± (441.95 - 442.89) ms469.53 ± (468.88 - 470.19) ms+6.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.25 ± (58.12 - 58.37) MB57.92 ± (57.77 - 58.07) MB-0.6%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.2%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms189.48 ± (189.15 - 189.82) ms198.82 ± (198.27 - 199.37) ms+4.9%✅⬆️
process.time_to_main_ms69.12 ± (68.96 - 69.28) ms72.61 ± (72.37 - 72.86) ms+5.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.80 ± (11.78 - 11.82) MB11.69 ± (11.67 - 11.70) MB-1.0%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.8%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms187.56 ± (187.35 - 187.78) ms198.43 ± (198.00 - 198.86) ms+5.8%✅⬆️
process.time_to_main_ms69.75 ± (69.68 - 69.83) ms74.11 ± (73.88 - 74.35) ms+6.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.82 ± (11.75 - 11.90) MB11.71 ± (11.70 - 11.73) MB-0.9%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+1.4%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms359.72 ± (357.98 - 361.45) ms370.09 ± (368.69 - 371.48) ms+2.9%✅⬆️
process.time_to_main_ms425.91 ± (425.28 - 426.54) ms436.88 ± (435.79 - 437.96) ms+2.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.96 ± (47.93 - 47.99) MB48.01 ± (47.99 - 48.04) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.1%
Comparison explanation

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 highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (74ms)  : 72, 77
    master - mean (69ms)  : 67, 70

    section Bailout
    This PR (7844) - mean (79ms)  : crit, 77, 82
    master - mean (72ms)  : 71, 73

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (1,063ms)  : 1002, 1123
    master - mean (1,008ms)  : 964, 1051

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (118ms)  : 113, 123
    master - mean (106ms)  : 104, 109

    section Bailout
    This PR (7844) - mean (119ms)  : crit, 115, 122
    master - mean (107ms)  : 106, 108

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (794ms)  : crit, 724, 864
    master - mean (737ms)  : 672, 803

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (104ms)  : 100, 107
    master - mean (93ms)  : 92, 95

    section Bailout
    This PR (7844) - mean (104ms)  : crit, 102, 106
    master - mean (94ms)  : 93, 95

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (758ms)  : crit, 704, 812
    master - mean (711ms)  : 682, 741

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (103ms)  : 99, 106
    master - mean (92ms)  : 89, 94

    section Bailout
    This PR (7844) - mean (104ms)  : crit, 102, 106
    master - mean (93ms)  : 92, 94

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (691ms)  : crit, 666, 716
    master - mean (631ms)  : 617, 646

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (192ms)  : 189, 196
    master - mean (192ms)  : 187, 197

    section Bailout
    This PR (7844) - mean (195ms)  : 192, 198
    master - mean (195ms)  : 193, 198

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (1,108ms)  : 1059, 1157
    master - mean (1,105ms)  : 1053, 1156

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (275ms)  : 270, 280
    master - mean (274ms)  : 270, 279

    section Bailout
    This PR (7844) - mean (276ms)  : 271, 280
    master - mean (275ms)  : 271, 279

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (924ms)  : 879, 969
    master - mean (925ms)  : 886, 964

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (287ms)  : 280, 294
    master - mean (268ms)  : 264, 273

    section Bailout
    This PR (7844) - mean (288ms)  : crit, 284, 293
    master - mean (268ms)  : 264, 273

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (973ms)  : 926, 1019
    master - mean (923ms)  : 894, 952

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7844) - mean (281ms)  : 270, 293
    master - mean (268ms)  : 263, 273

    section Bailout
    This PR (7844) - mean (283ms)  : crit, 274, 291
    master - mean (267ms)  : 264, 270

    section CallTarget+Inlining+NGEN
    This PR (7844) - mean (837ms)  : 800, 875
    master - mean (816ms)  : 795, 836

Loading

Copy link
Contributor

@GreenMatan GreenMatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pr-commenter
Copy link

pr-commenter bot commented Dec 29, 2025

Benchmarks

Benchmark execution time: 2025-12-29 14:25:56

Comparing candidate commit 171fff9 in PR branch dudik/el/fix-duration-error with baseline commit 23d037e in branch master.

Found 10 performance improvements and 2 performance regressions! Performance is the same for 165 metrics, 9 unstable metrics.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟩 execution_time [-19.765ms; -13.776ms] or [-9.505%; -6.624%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟩 execution_time [-17.683ms; -10.672ms] or [-8.693%; -5.247%]
  • 🟩 throughput [+5974.850op/s; +9300.355op/s] or [+6.676%; +10.391%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+71.890ms; +73.762ms] or [+56.640%; +58.115%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟩 execution_time [-18.772ms; -14.378ms] or [-10.219%; -7.827%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟩 execution_time [-49.911ms; -46.414ms] or [-25.003%; -23.251%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync netcoreapp3.1

  • 🟩 throughput [+6484.445op/s; +8099.073op/s] or [+5.820%; +7.269%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 throughput [+268.244op/s; +427.998op/s] or [+13.920%; +22.211%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • 🟩 execution_time [-11.088µs; -6.739µs] or [-19.188%; -11.662%]
  • 🟩 throughput [+2186.496op/s; +3364.729op/s] or [+12.325%; +18.967%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472

  • 🟩 throughput [+30695.190op/s; +33799.034op/s] or [+7.188%; +7.915%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟥 execution_time [+10.600ms; +16.263ms] or [+5.285%; +8.109%]

@dudikeleti dudikeleti merged commit 4fb09d3 into master Dec 29, 2025
156 checks passed
@dudikeleti dudikeleti deleted the dudik/el/fix-duration-error branch December 29, 2025 14:58
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants