Skip to content

Use the built-in System.Reflection.Metadata types for .NET Core#8454

Merged
andrewlock merged 10 commits intomasterfrom
andrew/remove-more-vendored-code
Apr 22, 2026
Merged

Use the built-in System.Reflection.Metadata types for .NET Core#8454
andrewlock merged 10 commits intomasterfrom
andrew/remove-more-vendored-code

Conversation

@andrewlock
Copy link
Copy Markdown
Member

@andrewlock andrewlock commented Apr 14, 2026

Summary of changes

Use the built-in System.Reflection.Metadata types for .NET Core 3.1+

Reason for change

In #6726, we switched from always using the vendored System.Memory and other BCL types, to using the built-in versions for .NET Core 3.1 where they're available. This was done with the goal of reducing artifact size, while also hopefully improving consistency, and potentially improving performance.

Separately, we're working on updating our vendored code to make updating it more repeatable (see #8391). This flagged a variety of modifications we'd made to the vendored System.Reflection.Metadata code to be able to use internal members.

Rather than include those modifications in the updated vendored code, this PR updates our existing usages to not use those internal members in any scenario. This also means we can stop using the vendored code for .NET Core 3.1+.

Implementation details

  • Add pollyfil for Hash type used by Debugger code, which was internal to System.Reflection.Metadata
    • Note that although this was called FNV1aHash, it isn't using FNV1a, so I chose to call it simple hash (as that's what it's doing, a simple "hash code" calculation).
    • If these hashes should be using FNV1A, then that should be addressed separately
  • Update namespaces to use the built-in versions where appropriate
    • These are intentionally not added to GlobalUsings.cs, because doing so causes a variety of namespace collisions across our vendored code (Newtonsoft.Json, dnlib)
    • A couple of unused using statements needed removing.
  • Stop using internal members on MethodDefinition
    • In some cases, there are simple replacements available, e.g. replacing FromRowId.
    • Removing usages of MethodDefinition.Handle was a little more painful, as it required more refactoring, but fundamentally we were always deriving a MethodDefinition from a MethodDefinitionHandle, so the changes are mostly a minor inconvenience, but they now only use public APIs.

Test coverage

Should be covered by existing tests; all these changes are just "refactorings", nothing additional.

Assembly size comparison

Runtime Before After Diff %
netcoreapp3.1 7,919.5 KB 7,484.0 KB -435.5 KB -5.50%
net6.0 8,016.5 KB 7,581.5 KB -435 KB -5.43%

Estimated size per namespace

Before (net6.0)

Total 7.15 MB (100.0%)
 └── Datadog 7.08 MB (99.1%)
     └── Trace 7.08 MB (99.1%)
         └── VendoredMicrosoftCode 0.54 MB (7.5%)
             └── System 0.54 MB (7.5%)
                 └── Reflection 0.52 MB (7.3%)
                     ├── Metadata 0.42 MB (5.8%)
                     ├── PortableExecutable 0.07 MB (1.0%)
                     └── Internal 0.03 MB (0.4%)

After (net6.0) (all gone)

Total 6.72 MB (100.0%)
 └── Datadog 6.66 MB (99.1%)
     └── Trace 6.66 MB (99.1%)

Other details

https://datadoghq.atlassian.net/browse/APMLP-1207

Part of a stack updating our vendored system code

@andrewlock andrewlock added type:refactor area:vendors Code from other vendors labels Apr 14, 2026
@andrewlock andrewlock changed the title Andrew/remove more vendored code Use the built-in System.Reflection.Metadata types for .NET Core Apr 14, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 14, 2026

Benchmarks

Benchmark execution time: 2026-04-22 11:56:39

Comparing candidate commit 1cd4ff9 in PR branch andrew/remove-more-vendored-code with baseline commit ac962de in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 26 metrics, 0 unstable metrics, 59 known flaky benchmarks, 28 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 throughput [-22497.557op/s; -19274.953op/s] or [-6.336%; -5.429%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

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

  • 🟩 throughput [+9311.219op/s; +11553.890op/s] or [+7.826%; +9.712%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+302.487ms; +304.105ms] or [+150.105%; +150.908%]

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

  • 🟥 execution_time [+384.105ms; +385.806ms] or [+303.466%; +304.811%]

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

  • 🟥 execution_time [+402.017ms; +403.300ms] or [+355.770%; +356.905%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.529%; +27.541%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.977%; +9.987%]
  • 🟩 execution_time [-15.775ms; -11.606ms] or [-7.367%; -5.420%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.502%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.746%; +105.759%]
  • 🟥 throughput [-245462.421op/s; -242738.628op/s] or [-25.063%; -24.785%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-26.267ms; -21.412ms] or [-11.714%; -9.549%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-143283.056op/s; -126476.444op/s] or [-20.587%; -18.172%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+10895.755op/s; +13929.650op/s] or [+6.933%; +8.863%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+7951.132op/s; +10616.768op/s] or [+6.334%; +8.458%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+385996.096op/s; +421603.424op/s] or [+12.871%; +14.058%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-19.062ms; -14.721ms] or [-8.787%; -6.786%]
  • 🟩 throughput [+194796.327op/s; +248780.728op/s] or [+7.732%; +9.875%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+300.259ms; +300.907ms] or [+150.029%; +150.353%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+301.511ms; +305.377ms] or [+152.053%; +154.002%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+299.816ms; +302.355ms] or [+151.024%; +152.303%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.078ms; +296.793ms] or [+145.422%; +145.773%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+297.214ms; +300.600ms] or [+145.297%; +146.952%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+301.935ms; +303.213ms] or [+150.907%; +151.545%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+22.327µs; +45.932µs] or [+7.128%; +14.664%]
  • 🟥 throughput [-427.760op/s; -229.133op/s] or [-13.335%; -7.143%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.772ms; +300.410ms] or [+149.617%; +149.936%]

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

  • 🟥 execution_time [+412.160ms; +418.995ms] or [+447.829%; +455.256%]
  • 🟩 throughput [+1060.752op/s; +1201.526op/s] or [+8.716%; +9.873%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+205.151ms; +251.393ms] or [+155.770%; +190.880%]
  • 🟩 throughput [+666.875op/s; +872.447op/s] or [+6.456%; +8.446%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+262.627ms; +321.336ms] or [+120.753%; +147.747%]
  • 🟥 throughput [-476.854op/s; -417.362op/s] or [-43.208%; -37.817%]

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

  • unstable execution_time [+203.328ms; +336.546ms] or [+86.650%; +143.422%]
  • 🟥 throughput [-751.362op/s; -667.837op/s] or [-50.116%; -44.545%]

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

  • 🟥 execution_time [+339.448ms; +346.814ms] or [+203.029%; +207.435%]
  • 🟥 throughput [-402.549op/s; -367.578op/s] or [-28.029%; -25.594%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-161.674µs; -118.419µs] or [-8.190%; -5.999%]
  • 🟩 throughput [+34.718op/s; +46.073op/s] or [+6.854%; +9.095%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+304.515ms; +306.046ms] or [+153.348%; +154.119%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+301.138ms; +302.169ms] or [+150.901%; +151.418%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+301.582ms; +304.989ms] or [+151.502%; +153.213%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.838ms; +304.352ms] or [+152.075%; +152.835%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+297.418ms; +299.567ms] or [+147.060%; +148.122%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+304.141ms; +307.989ms] or [+154.152%; +156.102%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.846ms; +304.862ms] or [+151.499%; +153.013%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+300.426ms; +302.755ms] or [+149.735%; +150.896%]
  • 🟩 throughput [+33181.288op/s; +38579.962op/s] or [+6.589%; +7.661%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+301.438ms; +304.677ms] or [+149.963%; +151.574%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.137ms; -12.477ms] or [-7.504%; -5.802%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+8.340µs; +49.060µs] or [+2.060%; +12.118%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-21.599KB; -21.579KB] or [-7.879%; -7.871%]
  • unstable execution_time [-35.793µs; +16.358µs] or [-7.074%; +3.233%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+6.491µs; +10.481µs] or [+15.344%; +24.775%]
  • 🟥 throughput [-4768.013op/s; -3005.639op/s] or [-20.072%; -12.653%]

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

  • unstable execution_time [-13.199µs; -5.265µs] or [-20.478%; -8.168%]
  • 🟩 throughput [+1497.076op/s; +3088.309op/s] or [+9.185%; +18.948%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.657ms; +303.133ms] or [+152.474%; +153.220%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+301.313ms; +303.746ms] or [+153.367%; +154.606%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+299.956ms; +302.106ms] or [+150.165%; +151.241%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+30230.773op/s; +34456.283op/s] or [+5.722%; +6.522%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.782ms; +301.646ms] or [+149.414%; +150.343%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+302.447ms; +304.157ms] or [+151.874%; +152.733%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+304.073ms; +306.475ms] or [+154.206%; +155.424%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.826ms; +300.465ms] or [+149.555%; +149.874%]
  • 🟩 throughput [+61097926.045op/s; +61345670.285op/s] or [+44.495%; +44.676%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+374.696ms; +410.990ms] or [+466.001%; +511.139%]
  • 🟩 throughput [+993.571op/s; +1171.619op/s] or [+7.681%; +9.057%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+298.951ms; +299.852ms] or [+149.110%; +149.559%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+93146.967op/s; +105708.608op/s] or [+8.697%; +9.870%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+47320.537op/s; +66644.176op/s] or [+5.477%; +7.714%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+97792.691op/s; +127176.244op/s] or [+7.569%; +9.844%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+85154.723op/s; +93000.151op/s] or [+8.457%; +9.236%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+44482.753op/s; +50005.056op/s] or [+8.077%; +9.080%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+24833.488op/s; +34960.474op/s] or [+5.559%; +7.825%]

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

  • 🟩 throughput [+83764.018op/s; +101196.556op/s] or [+9.359%; +11.306%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

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

dd-trace-dotnet-ci-bot Bot commented Apr 14, 2026

Execution-Time Benchmarks Report ⏱️

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

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration74.51 ± (74.31 - 74.79) ms75.11 ± (74.76 - 75.35) ms+0.8%✅⬆️
.NET Framework 4.8 - Bailout
duration77.75 ± (77.65 - 78.12) ms78.25 ± (78.06 - 78.55) ms+0.6%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1070.37 ± (1070.04 - 1076.13) ms1070.07 ± (1069.72 - 1074.91) ms-0.0%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.83 ± (22.76 - 22.90) ms22.86 ± (22.79 - 22.93) ms+0.2%✅⬆️
process.time_to_main_ms87.04 ± (86.72 - 87.35) ms87.58 ± (87.24 - 87.93) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.84 ± (10.83 - 10.84) MB10.90 ± (10.90 - 10.91) MB+0.6%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.35 ± (22.31 - 22.38) ms22.47 ± (22.43 - 22.51) ms+0.6%✅⬆️
process.time_to_main_ms86.23 ± (86.01 - 86.45) ms86.63 ± (86.40 - 86.86) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.94) MB10.94 ± (10.93 - 10.94) MB-0.0%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms227.84 ± (226.89 - 228.79) ms210.71 ± (209.91 - 211.51) ms-7.5%
process.time_to_main_ms526.24 ± (524.96 - 527.53) ms526.34 ± (525.16 - 527.52) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.46 ± (48.43 - 48.49) MB47.72 ± (47.69 - 47.76) MB-1.5%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%
.NET 6 - Baseline
process.internal_duration_ms21.47 ± (21.43 - 21.52) ms21.45 ± (21.40 - 21.51) ms-0.1%
process.time_to_main_ms74.76 ± (74.50 - 75.02) ms75.07 ± (74.82 - 75.33) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.62 - 10.62) MB10.61 ± (10.61 - 10.61) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.34 ± (21.29 - 21.39) ms21.13 ± (21.10 - 21.17) ms-1.0%
process.time_to_main_ms75.28 ± (75.02 - 75.53) ms74.54 ± (74.40 - 74.68) ms-1.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.73 ± (10.73 - 10.74) MB10.72 ± (10.72 - 10.73) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms385.20 ± (383.13 - 387.26) ms382.75 ± (380.42 - 385.07) ms-0.6%
process.time_to_main_ms526.20 ± (525.05 - 527.35) ms527.46 ± (526.09 - 528.83) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.86 ± (49.83 - 49.90) MB49.28 ± (49.26 - 49.31) MB-1.2%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.9%
.NET 8 - Baseline
process.internal_duration_ms19.38 ± (19.34 - 19.42) ms19.48 ± (19.44 - 19.52) ms+0.5%✅⬆️
process.time_to_main_ms71.84 ± (71.68 - 72.00) ms73.38 ± (73.18 - 73.58) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.67 - 7.68) MB7.64 ± (7.64 - 7.65) MB-0.4%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.71 ± (19.66 - 19.76) ms19.75 ± (19.70 - 19.81) ms+0.2%✅⬆️
process.time_to_main_ms75.16 ± (74.90 - 75.41) ms76.34 ± (76.05 - 76.63) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.70 ± (7.70 - 7.71) MB-0.2%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms303.95 ± (301.69 - 306.21) ms301.95 ± (299.97 - 303.92) ms-0.7%
process.time_to_main_ms489.43 ± (488.33 - 490.54) ms485.97 ± (484.97 - 486.98) ms-0.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.07 ± (37.05 - 37.09) MB36.40 ± (36.38 - 36.43) MB-1.8%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.0%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration204.68 ± (204.50 - 205.37) ms210.74 ± (210.67 - 211.67) ms+3.0%✅⬆️
.NET Framework 4.8 - Bailout
duration207.92 ± (207.66 - 208.37) ms214.61 ± (214.52 - 215.54) ms+3.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1193.33 ± (1193.63 - 1199.45) ms1231.22 ± (1232.95 - 1240.05) ms+3.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms197.37 ± (196.96 - 197.78) ms206.23 ± (205.76 - 206.70) ms+4.5%✅⬆️
process.time_to_main_ms86.36 ± (86.11 - 86.61) ms90.63 ± (90.31 - 90.94) ms+4.9%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.01 ± (15.99 - 16.04) MB15.86 ± (15.83 - 15.88) MB-1.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms197.19 ± (196.71 - 197.67) ms206.80 ± (206.32 - 207.28) ms+4.9%✅⬆️
process.time_to_main_ms87.61 ± (87.37 - 87.86) ms92.64 ± (92.37 - 92.90) ms+5.7%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.06 ± (16.04 - 16.09) MB15.93 ± (15.90 - 15.95) MB-0.9%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.9%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms409.06 ± (407.96 - 410.15) ms400.99 ± (399.66 - 402.31) ms-2.0%
process.time_to_main_ms534.13 ± (533.04 - 535.22) ms553.05 ± (551.63 - 554.47) ms+3.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed59.35 ± (59.31 - 59.39) MB58.44 ± (58.36 - 58.51) MB-1.5%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.8%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms204.09 ± (203.67 - 204.50) ms213.15 ± (212.69 - 213.60) ms+4.4%✅⬆️
process.time_to_main_ms75.42 ± (75.15 - 75.69) ms80.01 ± (79.77 - 80.24) ms+6.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.25 ± (16.22 - 16.27) MB16.16 ± (16.14 - 16.18) MB-0.6%
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (19 - 20)+1.9%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms201.87 ± (201.51 - 202.23) ms207.92 ± (207.47 - 208.37) ms+3.0%✅⬆️
process.time_to_main_ms75.83 ± (75.67 - 75.98) ms79.15 ± (78.91 - 79.38) ms+4.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.32 ± (16.30 - 16.35) MB16.25 ± (16.23 - 16.28) MB-0.4%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.3%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms602.81 ± (600.48 - 605.14) ms601.17 ± (598.90 - 603.45) ms-0.3%
process.time_to_main_ms531.06 ± (530.12 - 532.00) ms543.77 ± (542.67 - 544.86) ms+2.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.91 ± (61.84 - 61.99) MB61.16 ± (61.08 - 61.24) MB-1.2%
runtime.dotnet.threads.count31 ± (30 - 31)31 ± (31 - 31)+0.8%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms200.82 ± (200.34 - 201.30) ms207.81 ± (207.19 - 208.44) ms+3.5%✅⬆️
process.time_to_main_ms74.12 ± (73.88 - 74.37) ms76.96 ± (76.68 - 77.23) ms+3.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.64 ± (11.62 - 11.66) MB11.64 ± (11.62 - 11.65) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+1.8%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms200.51 ± (200.16 - 200.86) ms204.26 ± (203.75 - 204.77) ms+1.9%✅⬆️
process.time_to_main_ms75.34 ± (75.15 - 75.54) ms76.65 ± (76.48 - 76.83) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.70 ± (11.68 - 11.72) MB11.71 ± (11.69 - 11.73) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+1.5%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms523.04 ± (519.65 - 526.44) ms529.82 ± (523.84 - 535.80) ms+1.3%✅⬆️
process.time_to_main_ms495.63 ± (494.79 - 496.47) ms505.67 ± (504.74 - 506.60) ms+2.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.74 ± (50.70 - 50.78) MB50.33 ± (50.26 - 50.40) MB-0.8%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+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 (8454) - mean (75ms)  : 71, 79
    master - mean (75ms)  : 71, 78

    section Bailout
    This PR (8454) - mean (78ms)  : 75, 82
    master - mean (78ms)  : 74, 81

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (1,072ms)  : 1033, 1111
    master - mean (1,073ms)  : 1030, 1117

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 (8454) - mean (118ms)  : 112, 124
    master - mean (117ms)  : 111, 123

    section Bailout
    This PR (8454) - mean (116ms)  : 111, 120
    master - mean (115ms)  : 112, 119

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (775ms)  : 749, 801
    master - mean (793ms)  : 766, 821

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8454) - mean (103ms)  : 98, 109
    master - mean (103ms)  : 98, 108

    section Bailout
    This PR (8454) - mean (102ms)  : 100, 104
    master - mean (103ms)  : 99, 108

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (939ms)  : 898, 980
    master - mean (940ms)  : 905, 974

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8454) - mean (101ms)  : 96, 105
    master - mean (99ms)  : 95, 103

    section Bailout
    This PR (8454) - mean (104ms)  : 99, 109
    master - mean (103ms)  : 98, 107

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (819ms)  : 784, 854
    master - mean (826ms)  : 786, 865

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 (8454) - mean (211ms)  : 205, 217
    master - mean (205ms)  : 200, 210

    section Bailout
    This PR (8454) - mean (215ms)  : 210, 220
    master - mean (208ms)  : 204, 212

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (1,237ms)  : 1186, 1287
    master - mean (1,197ms)  : 1155, 1238

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 (8454) - mean (307ms)  : 300, 313
    master - mean (293ms)  : 286, 300

    section Bailout
    This PR (8454) - mean (309ms)  : 302, 316
    master - mean (294ms)  : 288, 299

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (999ms)  : 973, 1024
    master - mean (978ms)  : 939, 1017

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8454) - mean (302ms)  : 293, 312
    master - mean (288ms)  : 281, 296

    section Bailout
    This PR (8454) - mean (296ms)  : 287, 305
    master - mean (286ms)  : 282, 291

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (1,177ms)  : 1131, 1223
    master - mean (1,163ms)  : 1129, 1198

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8454) - mean (295ms)  : 279, 311
    master - mean (285ms)  : 278, 293

    section Bailout
    This PR (8454) - mean (291ms)  : 285, 297
    master - mean (287ms)  : 281, 293

    section CallTarget+Inlining+NGEN
    This PR (8454) - mean (1,071ms)  : 985, 1156
    master - mean (1,055ms)  : 1003, 1107

Loading

@andrewlock andrewlock marked this pull request as ready for review April 14, 2026 12:49
@andrewlock andrewlock requested review from a team as code owners April 14, 2026 12:49
Copy link
Copy Markdown
Contributor

@dudikeleti dudikeleti left a comment

Choose a reason for hiding this comment

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

👍🏼

Comment thread tracer/src/Datadog.Trace/PDBs/DatadogMetadataReader.cs Outdated
@andrewlock andrewlock force-pushed the andrew/remove-more-vendored-code branch from 0257651 to 1cd4ff9 Compare April 22, 2026 10:51
Copy link
Copy Markdown
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

LGTM

How did you calculate the estimated size stuff? I'm assuming just looking at the properties of the output in the file explorer?

@andrewlock
Copy link
Copy Markdown
Member Author

How did you calculate the estimated size stuff? I'm assuming just looking at the properties of the output in the file explorer?

Tool by this random guy (@lucaspimentel) 😄 https://github.com/lucaspimentel/analyze-assembly-size

@andrewlock andrewlock merged commit 1de5a0f into master Apr 22, 2026
143 checks passed
@andrewlock andrewlock deleted the andrew/remove-more-vendored-code branch April 22, 2026 14:43
@github-actions github-actions Bot added this to the vNext-v3 milestone Apr 22, 2026
andrewlock added a commit that referenced this pull request Apr 22, 2026
## Summary of changes

- Remove some unused types from System.Reflection.Metadata (mostly
around builder/writer infrastructure that was unused)
- Update the vendored version of System.Reflection.Metadata to use the
runtime repo directly, and bump to latest patch version

## Reason for change

We want to update our vendored .NET library versions.

## Implementation details

- Make the vendoring repeatable
- Run the tool, check for errors, tweak, rinse and repeat
- After running the tool, used 🤖 to identify segments of code that
weren't used, so we could strip them out

## Test coverage

This is the test, if it compiles and tests pass, we should be ok 🤞

## Other details

https://datadoghq.atlassian.net/browse/APMLP-1207

Part of a stack updating our vendored system code

- #8391

- #8454
Comment on lines +10 to +14
#if NETCOREAPP
using System.Reflection.Metadata;
#else
using Datadog.Trace.VendoredMicrosoftCode.System.Reflection.Metadata;
#endif
Copy link
Copy Markdown
Member

@lucaspimentel lucaspimentel Apr 22, 2026

Choose a reason for hiding this comment

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

We've been handling these here: https://github.com/DataDog/dd-trace-dotnet/blob/master/tracer/src/Datadog.Trace/GlobalUsings.cs

Was it intentional to not do it in this case?
(edit: comment applies to several files in this PR)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it was intentional. Unfortunately, there's a lot of overlap in type names between System.Reflection.Metadata and dnlib, such that adding this to global using causes a bunch of namespace conflicts in both dnlib code and Newtonsoft.JSON. Rather than have to change how those libraries are vendored, I figured it was probably better to just accept this here.

Given these are all pollyfilling system libraries, part of me wonders if it wouldn't be better to just keep their original namespaces 🤷‍♂️

andrewlock added a commit that referenced this pull request Apr 23, 2026
## Summary of changes

- Update the System.Memory based on NuGet package sources

## Reason for change

We want to update our vendored .NET library versions.

## Implementation details

- Make the vendoring repeatable
- Run the tool, check for errors, tweak, rinse and repeat
- After running the tool, used 🤖 to identify segments of code that
weren't used, so we could strip them out

The updated vendoring is based on the public
[System.Memory](https://www.nuget.org/packages/System.Memory/4.6.3#dependencies-body-tab)
nuget package, so is designed to be used with .NET Framework and .NET
Standard, so makes the most sense to use IMO.

As this package also uses _System.Buffers_ and
_System.Numerics.Vectors_, vendored those pieces we need where
appropriate.

## Test coverage

This is the test, if it compiles and tests pass, we should be ok 🤞

## Other details

https://datadoghq.atlassian.net/browse/APMLP-1207

Note that currently, there's a lot of `Utf8Formatter` code that _isn't_
used, and could be excluded, however, given that theoretically we
could/should use this in the future. I'm torn whether to just leave it
in, or whether to tear it out for now, and restore it if/when we want to
use it later. Any thoughts?

Part of a stack updating our vendored system code

- #8391
- #8454
- #8455
andrewlock added a commit that referenced this pull request Apr 23, 2026
## Summary of changes

Stop vendoring the `SR` + regex files for microsoft code

## Reason for change

Using `ResourceManager` is overkill, as we don't deploy all the
translations etc anyway, and don't want to.

## Implementation details

Replaced all the `SR.` accesses in previous PRs, so this is now dead
code that we can remove.

## Test coverage

If it builds, we're good

## Other details

https://datadoghq.atlassian.net/browse/APMLP-1207

Note that currently, there's a lot of `Utf8Formatter` code that _isn't_
used, and could be excluded, however, given that theoretically we
could/should use this in the future. I'm torn whether to just leave it
in, or whether to tear it out for now, and restore it if/when we want to
use it later. Any thoughts?

Part of a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
andrewlock added a commit that referenced this pull request Apr 23, 2026
## Summary of changes

- Create re-usable vendoring process for
System.Runtime.CompilerServices.Unsafe
- Update the vendored code (it's actually unchanged)

## Reason for change

We want to be able to update vendored code as required. For the vendored
[System.Runtime.CompilerServices.Unsafe
package](https://nuget.info/packages/System.Runtime.CompilerServices.Unsafe/6.1.2),
the [source
code](https://github.com/dotnet/maintenance-packages/blob/14e29655e53aec37342e933bfd7ba574167453ff/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il)
is written directly as IL, and [compiled using
Ilasm.exe](https://learn.microsoft.com/en-us/dotnet/framework/tools/ilasm-exe-il-assembler).
So this PR introduces a simple "IL to C#" converter that converts that
file to its C# equivalent, using the same `InlineIL.Fody` approach that
we currently have.

The final result produces a file that is _virtually_ identical to the
existing one (which is good!). The only difference I made was to add the
original IL line as a comment next to the Fody equivalent.

This also shows that the code has not _actually_ changed (and it's
unlikely it _will_ tbh), so this just means we have a repeatable
self-contained approach to regenerate this in the repo as required.

## Implementation details

Told 🤖 to make the IL to C# converter, and it did 😄 I've given the code
it generated a once-over to look for anything terrible, but the key
thing is that the _output_ is sane, and that's visibly basically
unchanged, so I think it's fine.

## Test coverage

@dudikeleti already wrote some extensive tests for the `Unsafe`
implementation back when he originally ported it, which verifies that we
can compile the methods, call them, and that the generated IL is
identical to the "real" versions 🎉

## Other details


https://datadoghq.atlassian.net/browse/APMLP-1207

Part of a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
- #8461
andrewlock added a commit that referenced this pull request Apr 24, 2026
#8476)

## Summary of changes

Updates the System.Memory vendoring code to move types like
`ReadOnlySpan<T>`, `Span<T>` into `System` instead of
`Datadog.Trace.VendoredMicrosoftCode.System`

## Reason for change

The compiler has various functionality that relies on the `Span<T>` (and
`ReadOnlySpan<T>`) being available in the `System` namespace. By making
this change, we get the advantage of those types being available.

A separate PR will actually update code to use those types, except where
changes were required to make it compile in this PR.

## Implementation details

Update the vendoring code to stop changing the namespace.

## Test coverage

This is the test, if the tests pass, we should be fine.

## Other details


Depends on a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
- #8461
- #8469
andrewlock added a commit that referenced this pull request Apr 24, 2026
## Summary of changes

Remove some branching code that's no longer required after #8476 moved
`Span<T>` to `System` namespace

## Reason for change

This sort of stuff is the _reason_ we made that change, to reduce
maintenance.

## Implementation details

Set 🤖 looking for possible cases, so it's not exhaustive, but gives a
taster. I think most of these make sense. It's nothing outstanding but
it's the little things.

## Test coverage

Just a refactoring, so covered by existing tests.

## Other details

By definition, we don't really expect to see performance improvements
for this, other than potentially some reduced allocation in .NET
Framework. The primary benefits are devx

Depends on the vendoring code stack:


Depends on a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
- #8461
- #8469
- #8476

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
andrewlock added a commit that referenced this pull request Apr 24, 2026
#8486)

## Summary of changes

Update the tag list generator to always use `ReadOnlySpan<byte>`
properties instead of `byte[]`

## Reason for change

After moving our vendored `Span<T>` implementation into the `System`
namespace, various optimizations open up to us, including using
`ReadOnlySpan<byte>` properties on .NET Framework instead of `static
readonly byte[]` to avoid startup costs.

## Implementation details

Replace the code generated by the generator, and update the generated
code

## Test coverage

Covered by snapshot tests and behaviour is covered by existing tests.
We'll check the benchmarks to make sure that we _don't_ see any perf
impact (there shouldn't be, impact should just be reduced startup costs)

## Other details

Depends on a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
- #8461
- #8469
- #8476
- #8477
andrewlock added a commit that referenced this pull request Apr 27, 2026
… string literals (#8487)

## Summary of changes

Convert `Encoding.Utf8.GetBytes` calls to static constants using UTF8
string literals

## Reason for change

After moving our vendored `Span<T>` implementation into the `System`
namespace, various optimizations open up to us, including using UTF-8
string literals, to encode strings to UTF-8 at compile time instead of
at runtime. By combing with `static ReadOnlySpan<byte>` properties,
these also become zero allocation, so we get reduced overall memory
usage as well as better startup time

## Implementation details

Replace the following with utf8 string literals:
- `StringEncoding.UTF8.GetBytes`
- `Encoding.UTF8.GetBytes`
- `EncodingHelpers.UTF8NoBom.GetBytes`

## Test coverage

All covered by existing tests

## Other details

Depends on a stack updating our vendored system code

- #8391
- #8454
- #8455
- #8459
- #8461
- #8469
- #8476
- #8477
- #8486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:vendors Code from other vendors type:refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants