Skip to content

Conversation

@NachoEchevarria
Copy link
Collaborator

@NachoEchevarria NachoEchevarria commented Nov 5, 2025

Summary of changes

We are getting the following error in master:

04:54:49 [DBG] Datadog.Trace.Tools.dd_dotnet.ArtifactTests: STARTED: Datadog.Trace.Tools.dd_dotnet.ArtifactTests.Checks.ProcessBasicChecksTests.WorkingWithContinuousProfiler(1, True)�[0m
04:54:49 [DBG] Datadog.Trace.Tools.dd_dotnet.ArtifactTests: STARTED: Datadog.Trace.Tools.dd_dotnet.ArtifactTests.Checks.AgentConnectivityCheckTests.DetectVersionNamedPipes()
...
04:54:51 [DBG]   Failed Datadog.Trace.Tools.dd_dotnet.ArtifactTests.Checks.ProcessBasicChecksTests.WorkingWithContinuousProfiler(enabled: "1", ssiInjectionEnabled: True) [390 ms]
04:54:51 [DBG]   Error Message:
04:54:51 [DBG]    System.ComponentModel.Win32Exception : Access is denied
04:54:51 [DBG]   Stack Trace:
04:54:51 [DBG]      at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
04:54:51 [DBG]    at System.Diagnostics.Process.Start()
04:54:51 [DBG]    at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
04:54:51 [DBG]    at Datadog.Trace.Tools.dd_dotnet.ArtifactTests.ConsoleTestHelper.<StartConsole>d__5.MoveNext()
04:54:51 [DBG] --- End of stack trace from previous location where exception was thrown ---
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
04:54:51 [DBG]    at Datadog.Trace.Tools.dd_dotnet.ArtifactTests.Checks.ProcessBasicChecksTests.<WorkingWithContinuousProfiler>d__13.MoveNext() in D:\a\_work\1\s\tracer\test\Datadog.Trace.Tools.dd_dotnet.ArtifactTests\Checks\ProcessBasicChecksTests.cs:line 244
04:54:51 [DBG] --- End of stack trace from previous location where exception was thrown ---
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
04:54:51 [DBG] --- End of stack trace from previous location where exception was thrown ---
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
04:54:51 [DBG] --- End of stack trace from previous location where exception was thrown ---
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
04:54:51 [DBG]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
04:54:51 [DBG]   Standard Output Messages:
04:54:51 [DBG]  Platform: X86
04:54:51 [DBG]  TargetPlatform: X86
04:54:51 [DBG]  Configuration: Release
04:54:51 [DBG]  TargetFramework: net48
04:54:51 [DBG]  .NET Core: False
04:54:51 [DBG]  Native Loader DLL: D:\a\_work\1\s\shared\bin\monitoring-home\win-x86\Datadog.Trace.ClrProfiler.Native.dll
04:54:51 [DBG]  Searching for CorFlags.exe in C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin
04:54:51 [DBG]  CorFlags.exe found at C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\CorFlags.exe
04:54:51 [DBG]  Updating Samples.Console.exe using /32BITREQ+

The "Access is denied" error happens when trying to start the process. This suggests that:

  1. The WorkingWithContinuousProfiler test is running at the same time as AgentConnectivityCheckTests which uses the same console app
  2. Each test case calls StartConsole, which calls PrepareSampleApp, which calls ProfilerHelper.SetCorFlags on line 46
    of ConsoleTestHelper.cs
  3. SetCorFlags modifies the same executable file in-place using CorFlags.exe
  4. One test thread is still running CorFlags.exe to modify the executable
  5. While CorFlags.exe has the file locked for writing
  6. Another test thread completes SetCorFlags() and tries to start that same executable
  7. Windows denies access because the file is still locked by CorFlags.exe from the other thread

So the lock needs to protect not just the CorFlags modification, but also ensure the CorFlags.exe process has fully
released the file lock before another thread can use that executable.

This error have been observed under Windows, net4, x86, which makes sense based on the ProfilerHelper.SetCorFlags conditions:

    protected (string Executable, string Args) PrepareSampleApp(EnvironmentHelper environmentHelper)
    {
        var sampleAppPath = environmentHelper.GetSampleApplicationPath();
        var executable = EnvironmentHelper.IsCoreClr() ? environmentHelper.GetSampleExecutionSource() : sampleAppPath;
        var args = EnvironmentHelper.IsCoreClr() ? sampleAppPath : string.Empty;

        if (EnvironmentTools.IsWindows()
         && !EnvironmentHelper.IsCoreClr()
         && !EnvironmentTools.IsTestTarget64BitProcess())
        {
            ProfilerHelper.SetCorFlags(executable, Output, !EnvironmentTools.IsTestTarget64BitProcess());
        }

        return (executable, args);
    }

Reason for change

Implementation details

Test coverage

Other details

@NachoEchevarria NachoEchevarria changed the title Add a lock to avoid exceptions Add a lock to avoid exceptions in ProcessBasicChecksTests Nov 5, 2025
@github-actions github-actions bot added the area:tests unit tests, integration tests label Nov 5, 2025
@datadog-official

This comment has been minimized.

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

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

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7781) 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.77 ± (74.81 - 75.73) ms73.30 ± (73.37 - 73.97) ms-2.0%
.NET Framework 4.8 - Bailout
duration78.90 ± (78.98 - 79.69) ms78.48 ± (78.61 - 79.37) ms-0.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1092.49 ± (1092.97 - 1101.04) ms1085.44 ± (1088.85 - 1097.18) ms-0.6%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.98 ± (22.90 - 23.06) ms22.80 ± (22.72 - 22.87) ms-0.8%
process.time_to_main_ms87.58 ± (87.15 - 88.02) ms85.82 ± (85.45 - 86.19) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.89 - 10.90) MB10.88 ± (10.87 - 10.88) MB-0.2%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.81 ± (22.74 - 22.87) ms22.54 ± (22.49 - 22.58) ms-1.2%
process.time_to_main_ms88.24 ± (87.90 - 88.57) ms87.01 ± (86.63 - 87.40) ms-1.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.93 - 10.94) MB10.92 ± (10.91 - 10.92) MB-0.2%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms220.11 ± (219.05 - 221.16) ms216.48 ± (215.19 - 217.77) ms-1.6%
process.time_to_main_ms545.21 ± (543.98 - 546.43) ms540.68 ± (539.53 - 541.83) ms-0.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed52.63 ± (52.61 - 52.65) MB52.49 ± (52.47 - 52.52) MB-0.3%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.5%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.58 ± (21.51 - 21.65) ms21.62 ± (21.55 - 21.69) ms+0.2%✅⬆️
process.time_to_main_ms75.26 ± (74.94 - 75.57) ms74.54 ± (74.19 - 74.89) ms-0.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.59 - 10.60) 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.51 ± (21.45 - 21.57) ms21.45 ± (21.39 - 21.51) ms-0.3%
process.time_to_main_ms76.30 ± (75.94 - 76.65) ms74.90 ± (74.59 - 75.20) ms-1.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.64 - 10.65) MB10.64 ± (10.64 - 10.64) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms205.98 ± (204.54 - 207.43) ms204.14 ± (202.75 - 205.53) ms-0.9%
process.time_to_main_ms511.62 ± (510.83 - 512.41) ms502.34 ± (501.29 - 503.40) ms-1.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed51.76 ± (51.72 - 51.80) MB51.63 ± (51.59 - 51.67) MB-0.2%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.79 ± (19.72 - 19.85) ms19.73 ± (19.66 - 19.79) ms-0.3%
process.time_to_main_ms74.49 ± (74.16 - 74.81) ms73.65 ± (73.33 - 73.96) ms-1.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.66 ± (7.66 - 7.67) MB7.62 ± (7.62 - 7.63) MB-0.5%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.73 ± (19.67 - 19.79) ms19.55 ± (19.50 - 19.60) ms-0.9%
process.time_to_main_ms75.27 ± (75.04 - 75.51) ms74.28 ± (73.99 - 74.58) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.67 ± (7.66 - 7.67) MB-0.6%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms188.43 ± (187.42 - 189.44) ms189.27 ± (188.30 - 190.25) ms+0.4%✅⬆️
process.time_to_main_ms486.98 ± (485.97 - 487.99) ms481.76 ± (480.76 - 482.75) ms-1.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed38.98 ± (38.94 - 39.02) MB38.80 ± (38.76 - 38.85) MB-0.4%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration191.32 ± (190.93 - 191.68) ms194.74 ± (194.47 - 195.37) ms+1.8%✅⬆️
.NET Framework 4.8 - Bailout
duration194.71 ± (194.33 - 194.98) ms195.67 ± (195.42 - 195.99) ms+0.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1154.81 ± (1160.54 - 1170.47) ms1158.56 ± (1162.40 - 1171.64) ms+0.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms186.52 ± (186.14 - 186.89) ms187.31 ± (186.99 - 187.63) ms+0.4%✅⬆️
process.time_to_main_ms80.34 ± (80.11 - 80.57) ms81.09 ± (80.90 - 81.28) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.09 ± (16.06 - 16.12) MB16.12 ± (16.10 - 16.14) MB+0.2%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (19 - 20)-0.1%
.NET Core 3.1 - Bailout
process.internal_duration_ms185.60 ± (185.25 - 185.95) ms187.11 ± (186.79 - 187.44) ms+0.8%✅⬆️
process.time_to_main_ms81.39 ± (81.21 - 81.56) ms81.93 ± (81.75 - 82.12) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.17 ± (16.14 - 16.20) MB16.21 ± (16.18 - 16.24) MB+0.3%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.4%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms392.07 ± (389.61 - 394.53) ms398.94 ± (395.99 - 401.90) ms+1.8%✅⬆️
process.time_to_main_ms513.73 ± (513.00 - 514.45) ms513.47 ± (512.85 - 514.09) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed62.93 ± (62.78 - 63.09) MB62.88 ± (62.73 - 63.03) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms189.61 ± (189.18 - 190.04) ms190.51 ± (190.28 - 190.74) ms+0.5%✅⬆️
process.time_to_main_ms68.97 ± (68.79 - 69.16) ms69.27 ± (69.13 - 69.42) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.89 ± (15.73 - 16.05) MB15.87 ± (15.71 - 16.02) MB-0.1%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 6 - Bailout
process.internal_duration_ms190.35 ± (189.97 - 190.74) ms190.15 ± (189.88 - 190.41) ms-0.1%
process.time_to_main_ms70.44 ± (70.28 - 70.60) ms70.25 ± (70.16 - 70.34) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.90 ± (15.73 - 16.07) MB15.86 ± (15.69 - 16.03) MB-0.3%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.2%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms408.75 ± (405.58 - 411.92) ms405.30 ± (402.83 - 407.77) ms-0.8%
process.time_to_main_ms484.54 ± (483.98 - 485.10) ms478.59 ± (478.04 - 479.14) ms-1.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed62.00 ± (61.85 - 62.16) MB62.03 ± (61.89 - 62.18) MB+0.1%✅⬆️
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (29 - 30)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms188.53 ± (188.15 - 188.91) ms188.77 ± (188.47 - 189.06) ms+0.1%✅⬆️
process.time_to_main_ms68.92 ± (68.73 - 69.11) ms69.04 ± (68.86 - 69.22) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.72 ± (11.70 - 11.75) MB11.73 ± (11.70 - 11.77) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.6%
.NET 8 - Bailout
process.internal_duration_ms188.68 ± (188.20 - 189.15) ms187.97 ± (187.72 - 188.22) ms-0.4%
process.time_to_main_ms69.88 ± (69.72 - 70.04) ms69.95 ± (69.84 - 70.06) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.76 ± (11.72 - 11.80) MB11.78 ± (11.74 - 11.82) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.0%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms356.37 ± (354.86 - 357.88) ms359.41 ± (357.78 - 361.04) ms+0.9%✅⬆️
process.time_to_main_ms462.29 ± (461.64 - 462.95) ms456.26 ± (455.66 - 456.86) ms-1.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.49 ± (50.46 - 50.53) MB50.24 ± (50.20 - 50.28) MB-0.5%
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 (7781) - mean (74ms)  : 69, 78
    master - mean (75ms)  : 68, 82

    section Bailout
    This PR (7781) - mean (79ms)  : 74, 84
    master - mean (79ms)  : 74, 84

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (1,093ms)  : 1034, 1152
    master - mean (1,097ms)  : 1039, 1155

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 (7781) - mean (116ms)  : 109, 122
    master - mean (118ms)  : 110, 126

    section Bailout
    This PR (7781) - mean (117ms)  : 109, 125
    master - mean (118ms)  : 113, 124

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (788ms)  : 751, 825
    master - mean (805ms)  : 777, 834

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

    section Bailout
    This PR (7781) - mean (103ms)  : 97, 109
    master - mean (105ms)  : 99, 111

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (740ms)  : 699, 781
    master - mean (759ms)  : 726, 792

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

    section Bailout
    This PR (7781) - mean (102ms)  : 97, 107
    master - mean (103ms)  : 98, 109

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (706ms)  : 674, 738
    master - mean (719ms)  : 694, 744

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 (7781) - mean (195ms)  : 190, 200
    master - mean (191ms)  : 188, 195

    section Bailout
    This PR (7781) - mean (196ms)  : 193, 198
    master - mean (195ms)  : 191, 198

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (1,167ms)  : 1099, 1235
    master - mean (1,166ms)  : 1090, 1241

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 (7781) - mean (277ms)  : 272, 282
    master - mean (275ms)  : 269, 281

    section Bailout
    This PR (7781) - mean (277ms)  : 273, 281
    master - mean (275ms)  : 271, 280

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (948ms)  : 892, 1004
    master - mean (943ms)  : 904, 981

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7781) - mean (268ms)  : 265, 271
    master - mean (267ms)  : 261, 273

    section Bailout
    This PR (7781) - mean (268ms)  : 266, 271
    master - mean (269ms)  : 262, 276

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (914ms)  : 873, 955
    master - mean (925ms)  : 878, 973

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7781) - mean (267ms)  : 263, 272
    master - mean (267ms)  : 261, 272

    section Bailout
    This PR (7781) - mean (267ms)  : 264, 270
    master - mean (268ms)  : 260, 275

    section CallTarget+Inlining+NGEN
    This PR (7781) - mean (848ms)  : 829, 866
    master - mean (849ms)  : 822, 877

Loading

@pr-commenter
Copy link

pr-commenter bot commented Nov 5, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7781 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.134
  • 5 benchmarks have fewer allocations
  • 8 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.11 KB 6.01 KB -103 B -1.68%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 11.1μs 56.6ns 271ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 13.6μs 68.9ns 308ns 0 0 0 5.69 KB
master StartStopWithChild net472 22.7μs 130ns 964ns 0.957 0.319 0 6.11 KB
#7781 StartStopWithChild net6.0 11μs 59.9ns 354ns 0 0 0 5.51 KB
#7781 StartStopWithChild netcoreapp3.1 14.4μs 49.1ns 190ns 0 0 0 5.7 KB
#7781 StartStopWithChild net472 22μs 120ns 729ns 0.99 0.297 0.099 6.01 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.31 KB 3.35 KB 46 B 1.39%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 935μs 171ns 618ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 158ns 590ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.2ms 710ns 2.75μs 0 0 0 3.31 KB
#7781 WriteAndFlushEnrichedTraces net6.0 942μs 1.13μs 4.36μs 0 0 0 2.71 KB
#7781 WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 338ns 1.26μs 0 0 0 2.7 KB
#7781 WriteAndFlushEnrichedTraces net472 1.19ms 339ns 1.31μs 0 0 0 3.35 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 1.08μs 5.78ns 32.2ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.38μs 7.59ns 48ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.05μs 0.957ns 3.58ns 0.194 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 6.98μs 34.6ns 158ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.98μs 44.5ns 199ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.58μs 4.88ns 18.9ns 0.718 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 318ns 1.66ns 7.6ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 403ns 2.15ns 11.2ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 297ns 0.025ns 0.097ns 0.0434 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.28μs 29.4ns 114ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.89μs 30.3ns 113ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.7μs 3.66ns 14.2ns 0.57 0 0 3.8 KB
#7781 AllCycleSimpleBody net6.0 1.05μs 6.22ns 61.9ns 0 0 0 1.22 KB
#7781 AllCycleSimpleBody netcoreapp3.1 1.43μs 2.25ns 8.72ns 0 0 0 1.2 KB
#7781 AllCycleSimpleBody net472 1.02μs 0.39ns 1.46ns 0.192 0 0 1.23 KB
#7781 AllCycleMoreComplexBody net6.0 7.16μs 33.5ns 134ns 0 0 0 4.72 KB
#7781 AllCycleMoreComplexBody netcoreapp3.1 8.96μs 44.4ns 203ns 0 0 0 4.62 KB
#7781 AllCycleMoreComplexBody net472 7.64μs 3.08ns 11.5ns 0.725 0 0 4.74 KB
#7781 ObjectExtractorSimpleBody net6.0 311ns 1.79ns 12.9ns 0 0 0 280 B
#7781 ObjectExtractorSimpleBody netcoreapp3.1 396ns 2.18ns 13.3ns 0 0 0 272 B
#7781 ObjectExtractorSimpleBody net472 302ns 0.0191ns 0.0687ns 0.0441 0 0 281 B
#7781 ObjectExtractorMoreComplexBody net6.0 6.4μs 2.35ns 9.08ns 0 0 0 3.78 KB
#7781 ObjectExtractorMoreComplexBody netcoreapp3.1 7.73μs 26.6ns 103ns 0 0 0 3.69 KB
#7781 ObjectExtractorMoreComplexBody net472 6.71μs 3.21ns 12ns 0.571 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 77.2μs 296ns 1.15μs 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 99.5μs 429ns 1.66μs 0 0 0 32.4 KB
master EncodeArgs net472 110μs 17.8ns 68.8ns 4.93 0 0 32.51 KB
master EncodeLegacyArgs net6.0 143μs 171ns 663ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 198μs 156ns 606ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 121ns 470ns 0 0 0 2.16 KB
#7781 EncodeArgs net6.0 77.1μs 224ns 867ns 0 0 0 32.4 KB
#7781 EncodeArgs netcoreapp3.1 98.1μs 213ns 824ns 0 0 0 32.4 KB
#7781 EncodeArgs net472 110μs 32.5ns 126ns 4.95 0 0 32.51 KB
#7781 EncodeLegacyArgs net6.0 144μs 49.8ns 193ns 0 0 0 2.15 KB
#7781 EncodeLegacyArgs netcoreapp3.1 209μs 77.9ns 291ns 0 0 0 2.14 KB
#7781 EncodeLegacyArgs net472 265μs 128ns 494ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 393μs 123ns 476ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 424μs 398ns 1.54μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 430μs 53.6ns 208ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 283μs 60.7ns 235ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 304μs 73ns 283ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 309μs 71.6ns 277ns 0 0 0 2.29 KB
#7781 RunWafRealisticBenchmark net6.0 397μs 240ns 897ns 0 0 0 4.55 KB
#7781 RunWafRealisticBenchmark netcoreapp3.1 411μs 113ns 406ns 0 0 0 4.48 KB
#7781 RunWafRealisticBenchmark net472 436μs 68.1ns 264ns 0 0 0 4.66 KB
#7781 RunWafRealisticBenchmarkWithAttack net6.0 283μs 38.3ns 138ns 0 0 0 2.24 KB
#7781 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 297μs 135ns 524ns 0 0 0 2.22 KB
#7781 RunWafRealisticBenchmarkWithAttack net472 312μs 34.9ns 131ns 0 0 0 2.29 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 61.9μs 102ns 381ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 70.8μs 137ns 493ns 0 0 0 17.42 KB
master SendRequest net472 0.00303ns 0.00128ns 0.00495ns 0 0 0 0 b
#7781 SendRequest net6.0 61.3μs 52.8ns 190ns 0 0 0 14.52 KB
#7781 SendRequest netcoreapp3.1 70.6μs 85ns 306ns 0 0 0 17.42 KB
#7781 SendRequest net472 0.00521ns 0.00184ns 0.00711ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 0 b 73 B 73 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 0 b 47 B 47 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 7 B 3 B 75.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.93ms 1.87μs 7.24μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.12ms 1.16μs 4.19μs 0 0 0 640 KB
master OriginalCharSlice net472 2.65ms 170ns 660ns 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.37ms 69.3ns 259ns 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.7ms 2.5μs 9.7μs 0 0 0 1 B
master OptimizedCharSlice net472 2.02ms 245ns 949ns 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 901μs 24.6ns 91.9ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 821μs 117ns 453ns 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.13ms 74.6ns 289ns 0 0 0 0 b
#7781 OriginalCharSlice net6.0 1.93ms 5.6μs 21.7μs 0 0 0 640.01 KB
#7781 OriginalCharSlice netcoreapp3.1 2.12ms 5.33μs 20.6μs 0 0 0 640 KB
#7781 OriginalCharSlice net472 2.57ms 340ns 1.27μs 100 0 0 641.95 KB
#7781 OptimizedCharSlice net6.0 1.45ms 94.3ns 365ns 0 0 0 7 B
#7781 OptimizedCharSlice netcoreapp3.1 1.69ms 396ns 1.53μs 0 0 0 1 B
#7781 OptimizedCharSlice net472 1.9ms 215ns 831ns 0 0 0 73 B
#7781 OptimizedCharSliceWithPool net6.0 832μs 26.2ns 101ns 0 0 0 3 B
#7781 OptimizedCharSliceWithPool netcoreapp3.1 848μs 119ns 459ns 0 0 0 1 B
#7781 OptimizedCharSliceWithPool net472 1.15ms 60.2ns 225ns 0 0 0 47 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7781

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.134 686,040.14 777,984.82

More allocations ⚠️ in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.71 KB 42.45 KB 743 B 1.78%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.88 KB 42.09 KB 211 B 0.50%

Fewer allocations 🎉 in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.49 KB 56.15 KB -341 B -0.60%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 654μs 3.22μs 14.4μs 0 0 0 41.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 686μs 864ns 3.23μs 0 0 0 41.88 KB
master WriteAndFlushEnrichedTraces net472 936μs 3.51μs 13.6μs 8.33 0 0 56.49 KB
#7781 WriteAndFlushEnrichedTraces net6.0 724μs 2.86μs 10.7μs 0 0 0 42.45 KB
#7781 WriteAndFlushEnrichedTraces netcoreapp3.1 756μs 4.4μs 41.5μs 0 0 0 42.09 KB
#7781 WriteAndFlushEnrichedTraces net472 875μs 3.55μs 13.3μs 8.33 0 0 56.15 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.97μs 2.57ns 9.95ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.66μs 3.75ns 14.5ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.91μs 5.2ns 20.2ns 0.146 0.0146 0 987 B
#7781 ExecuteNonQuery net6.0 1.88μs 9ns 38.2ns 0 0 0 1.02 KB
#7781 ExecuteNonQuery netcoreapp3.1 2.62μs 5.75ns 22.3ns 0 0 0 1.02 KB
#7781 ExecuteNonQuery net472 2.87μs 2.69ns 10.4ns 0.144 0.0144 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.66μs 8.52ns 40ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.21μs 9.87ns 38.2ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.61μs 3.37ns 12.6ns 0.163 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.93μs 4.94ns 19.1ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.39μs 10.8ns 41.8ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.71μs 6.48ns 25.1ns 0.165 0 0 1.1 KB
#7781 CallElasticsearch net6.0 1.68μs 0.929ns 3.35ns 0 0 0 1.03 KB
#7781 CallElasticsearch netcoreapp3.1 2.15μs 10.1ns 40.4ns 0 0 0 1.03 KB
#7781 CallElasticsearch net472 3.52μs 1.12ns 4.19ns 0.158 0 0 1.04 KB
#7781 CallElasticsearchAsync net6.0 1.92μs 3.23ns 12.1ns 0 0 0 1.01 KB
#7781 CallElasticsearchAsync netcoreapp3.1 2.34μs 8.52ns 33ns 0 0 0 1.08 KB
#7781 CallElasticsearchAsync net472 3.66μs 2.2ns 8.52ns 0.165 0 0 1.1 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.91μs 7.12ns 27.6ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.37μs 9.45ns 35.4ns 0 0 0 952 B
master ExecuteAsync net472 2.54μs 0.933ns 3.61ns 0.139 0 0 915 B
#7781 ExecuteAsync net6.0 1.89μs 9.93ns 48.6ns 0 0 0 953 B
#7781 ExecuteAsync netcoreapp3.1 2.34μs 5.66ns 21.2ns 0 0 0 952 B
#7781 ExecuteAsync net472 2.52μs 1.31ns 5.07ns 0.139 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 7.14μs 5.72ns 22.1ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.43μs 15.9ns 61.4ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 10.2ns 38.3ns 0.492 0 0 3.18 KB
#7781 SendAsync net6.0 6.92μs 5.9ns 22.9ns 0 0 0 2.36 KB
#7781 SendAsync netcoreapp3.1 8.9μs 22.3ns 86.4ns 0 0 0 2.9 KB
#7781 SendAsync net472 12.1μs 11.8ns 45.9ns 0.488 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 258.63 KB 275.03 KB 16.4 KB 6.34%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 256.22 KB 259.38 KB 3.17 KB 1.24%

Fewer allocations 🎉 in #7781

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.39 KB 43.18 KB -1.22 KB -2.74%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 278.53 KB -8.19 KB -2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 65.54 KB 57.34 KB -8.19 KB -12.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 49.4μs 779ns 7.72μs 0 0 0 44.39 KB
master StringConcatBenchmark netcoreapp3.1 49.5μs 271ns 2.16μs 0 0 0 42.83 KB
master StringConcatBenchmark net472 57μs 100ns 348ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 435μs 1.38μs 4.78μs 0 0 0 256.22 KB
master StringConcatAspectBenchmark netcoreapp3.1 507μs 1.02μs 4.43μs 0 0 0 258.63 KB
master StringConcatAspectBenchmark net472 400μs 1.84μs 7.12μs 0 0 0 286.72 KB
#7781 StringConcatBenchmark net6.0 42.5μs 228ns 1.16μs 0 0 0 43.18 KB
#7781 StringConcatBenchmark netcoreapp3.1 48.2μs 269ns 1.64μs 0 0 0 42.64 KB
#7781 StringConcatBenchmark net472 57.6μs 110ns 412ns 0 0 0 57.34 KB
#7781 StringConcatAspectBenchmark net6.0 464μs 712ns 2.47μs 0 0 0 259.38 KB
#7781 StringConcatAspectBenchmark netcoreapp3.1 519μs 2.72μs 13.3μs 0 0 0 275.03 KB
#7781 StringConcatAspectBenchmark net472 399μs 2.27μs 16.7μs 0 0 0 278.53 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 2.58μs 11.9ns 47.6ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.61μs 17.4ns 75.9ns 0 0 0 1.7 KB
master EnrichedLog net472 3.98μs 4.88ns 18.9ns 0.258 0 0 1.64 KB
#7781 EnrichedLog net6.0 2.62μs 9.86ns 38.2ns 0 0 0 1.7 KB
#7781 EnrichedLog netcoreapp3.1 3.62μs 17.1ns 63.9ns 0 0 0 1.7 KB
#7781 EnrichedLog net472 4.07μs 6.54ns 25.3ns 0.243 0 0 1.64 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 123μs 334ns 1.29μs 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 128μs 275ns 990ns 0 0 0 4.31 KB
master EnrichedLog net472 173μs 395ns 1.53μs 0 0 0 4.52 KB
#7781 EnrichedLog net6.0 125μs 160ns 599ns 0 0 0 4.31 KB
#7781 EnrichedLog netcoreapp3.1 129μs 146ns 546ns 0 0 0 4.31 KB
#7781 EnrichedLog net472 170μs 301ns 1.17μs 0 0 0 4.52 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 5.3μs 18ns 69.5ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.74μs 25.4ns 98.2ns 0 0 0 2.26 KB
master EnrichedLog net472 7.57μs 6.16ns 23.9ns 0.302 0 0 2.08 KB
#7781 EnrichedLog net6.0 5.2μs 19.6ns 75.8ns 0 0 0 2.26 KB
#7781 EnrichedLog netcoreapp3.1 7.11μs 5.28ns 20.4ns 0 0 0 2.26 KB
#7781 EnrichedLog net472 7.72μs 5.36ns 20.7ns 0.311 0 0 2.08 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.94μs 9.27ns 35.9ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.65μs 11.5ns 44.6ns 0 0 0 1.2 KB
master SendReceive net472 3.1μs 1.85ns 7.16ns 0.184 0 0 1.2 KB
#7781 SendReceive net6.0 1.99μs 9.83ns 44ns 0 0 0 1.2 KB
#7781 SendReceive netcoreapp3.1 2.61μs 14.3ns 82.1ns 0 0 0 1.2 KB
#7781 SendReceive net472 3.03μs 0.527ns 1.82ns 0.183 0 0 1.2 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 4.35μs 7.54ns 29.2ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.65μs 4.4ns 15.9ns 0 0 0 1.63 KB
master EnrichedLog net472 6.56μs 5.41ns 21ns 0.296 0 0 2.03 KB
#7781 EnrichedLog net6.0 4.24μs 8.82ns 34.2ns 0 0 0 1.58 KB
#7781 EnrichedLog netcoreapp3.1 5.52μs 13.6ns 51ns 0 0 0 1.63 KB
#7781 EnrichedLog net472 6.51μs 13.5ns 52.2ns 0.321 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 783ns 0.292ns 1.09ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 961ns 5.18ns 29.3ns 0 0 0 576 B
master StartFinishSpan net472 933ns 1.11ns 4.29ns 0.0893 0 0 578 B
master StartFinishScope net6.0 904ns 4.81ns 25.5ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.21μs 5.35ns 20.7ns 0 0 0 696 B
master StartFinishScope net472 1.12μs 0.561ns 2.17ns 0.102 0 0 658 B
#7781 StartFinishSpan net6.0 804ns 3.78ns 15.1ns 0 0 0 576 B
#7781 StartFinishSpan netcoreapp3.1 961ns 4.84ns 22.2ns 0 0 0 576 B
#7781 StartFinishSpan net472 962ns 0.841ns 3.26ns 0.0876 0 0 578 B
#7781 StartFinishScope net6.0 933ns 4.64ns 21.8ns 0 0 0 696 B
#7781 StartFinishScope netcoreapp3.1 1.21μs 6ns 26.8ns 0 0 0 696 B
#7781 StartFinishScope net472 1.11μs 0.557ns 1.93ns 0.101 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 1.06μs 5.51ns 28.1ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.46μs 3.1ns 12ns 0 0 0 696 B
master RunOnMethodBegin net472 1.46μs 1.29ns 4.82ns 0.103 0 0 658 B
#7781 RunOnMethodBegin net6.0 1.07μs 0.816ns 3.16ns 0 0 0 696 B
#7781 RunOnMethodBegin netcoreapp3.1 1.45μs 7.25ns 30.7ns 0 0 0 696 B
#7781 RunOnMethodBegin net472 1.54μs 0.626ns 2.34ns 0.101 0 0 658 B

@NachoEchevarria NachoEchevarria marked this pull request as ready for review November 5, 2025 16:02
@NachoEchevarria NachoEchevarria requested a review from a team as a code owner November 5, 2025 16:02
@NachoEchevarria NachoEchevarria marked this pull request as draft November 5, 2025 16:13
@NachoEchevarria NachoEchevarria changed the title Add a lock to avoid exceptions in ProcessBasicChecksTests Avoid exceptions in ProcessBasicChecksTests Nov 6, 2025
if (string.IsNullOrEmpty(corFlagsExe))
// Use the absolute path as the key to track which executables have been modified
var executablePath = Path.GetFullPath(executable);
var lockObj = _corFlagsLocks.GetOrAdd(executablePath, _ => new object());
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it's fine to have a single lock object that's used when applying the flags tbh, and to have a fast-path outside the lock that checks if they're already applied.

e.g.

private readonly object _lockObj = new();

//...

var executablePath = Path.GetFullPath(executable);
if (_corFlagsApplied.TryGetValue(executablePath, out _))
{
    return;
}

// not applied
lock (_lockObj)
{
   // check again to be safe
  if (_corFlagsApplied.TryGetValue(executablePath, out _))
  {
      return;
  }

  // do the check
}

That way we don't need a lock per executable, and we avoid taking the lock (and having that contention) every time we start an app? wdyt?

Another tiny thing is I wonder if we need to check that we've set CorFlags correctly i.e. 32 bit or 64 bit. I don't think so, because I think we only set that based on whether we run the whole test suite as 32bit or 64bit, is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A single lock is more simple and the performance impact would be negligible. I will apply that. Thanks!
Yes, we don't need to check the corflags because the whole test suite would run either in x86 or x64

@NachoEchevarria NachoEchevarria marked this pull request as ready for review November 6, 2025 11:40
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

.ToArray();

private static readonly object _lockObj = new();
private static readonly ConcurrentDictionary<string, bool> _corFlagsApplied = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

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

nit: should we ignore case 🤔 On Linux for example there could be two different samples with the same name, just different cases 😅 I don't think it's a problem in reality though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, we only change cor vars in Windows x86 net4, so I would keep it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants