Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NullReferenceException in ASP.NET Core when RoutePattern.RawText is null (#5880 -> v2) #5888

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

andrewlock
Copy link
Member

Summary of changes

Fix NullReferenceException in aspnetcore handler

Reason for change

RoutePattern.RawText can be null

Implementation details

Add #nullable enable annotation to the duck type, and AspNetCoreResourceNameHelper and follow the errors.

Test coverage

Covered by existing in general, hard to reproduce this specific bug

Backport of #5880

…xt` is `null` (#5880)

## Summary of changes

Fix `NullReferenceException` in aspnetcore handler

## Reason for change

`RoutePattern.RawText` can be null

## Implementation details

Add `#nullable enable` annotation to the duck type, and
`AspNetCoreResourceNameHelper` and follow the errors.

## Test coverage

Covered by existing in general, hard to reproduce this specific bug


<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->
@andrewlock andrewlock added type:bug area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) identified-by:telemetry labels Aug 13, 2024
@andrewlock andrewlock requested review from a team as code owners August 13, 2024 11:58
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Aug 13, 2024

Datadog Report

Branch report: andrew/fix-aspnetcore-bug-v2
Commit report: 7bf4759
Test service: dd-trace-dotnet

✅ 0 Failed, 343486 Passed, 1763 Skipped, 14h 11m 38.6s Total Time
⌛ 14 Performance Regressions

⌛ Performance Regressions vs Default Branch (14)

This report shows up to 5 performance regressions.

  • Profiler_cpu_walltime_old_stackwalk - scenarios 3.24s (+900.3ms, +38%) - Details
  • Profiler_cpu_walltime - scenarios 3.23s (+888.28ms, +38%) - Details
  • Profiler_walltime - scenarios 3.25s (+907.1ms, +39%) - Details
  • Profiler_cpu_walltime_timer_create - scenarios 3.24s (+895.55ms, +38%) - Details
  • Profiler_liveheap - scenarios 4.21s (+1.03s, +33%) - Details

@andrewlock
Copy link
Member Author

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:

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

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (74ms)  : 63, 85
     .   : milestone, 74,
    master - mean (73ms)  : 63, 84
     .   : milestone, 73,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (1,032ms)  : 1011, 1052
     .   : milestone, 1032,
    master - mean (1,068ms)  : 1047, 1088
     .   : milestone, 1068,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (110ms)  : 106, 115
     .   : milestone, 110,
    master - mean (109ms)  : 105, 114
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (724ms)  : 706, 743
     .   : milestone, 724,
    master - mean (748ms)  : 725, 771
     .   : milestone, 748,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (93ms)  : 89, 96
     .   : milestone, 93,
    master - mean (92ms)  : 90, 95
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (676ms)  : 652, 700
     .   : milestone, 676,
    master - mean (702ms)  : 685, 719
     .   : milestone, 702,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (192ms)  : 188, 196
     .   : milestone, 192,
    master - mean (193ms)  : 188, 198
     .   : milestone, 193,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (1,129ms)  : 1107, 1151
     .   : milestone, 1129,
    master - mean (1,169ms)  : 1137, 1200
     .   : milestone, 1169,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (277ms)  : 273, 281
     .   : milestone, 277,
    master - mean (276ms)  : 272, 281
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (894ms)  : 859, 928
     .   : milestone, 894,
    master - mean (918ms)  : 897, 939
     .   : milestone, 918,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5888) - mean (267ms)  : 263, 271
     .   : milestone, 267,
    master - mean (266ms)  : 262, 270
     .   : milestone, 266,

    section CallTarget+Inlining+NGEN
    This PR (5888) - mean (885ms)  : 856, 913
     .   : milestone, 885,
    master - mean (903ms)  : 884, 921
     .   : milestone, 903,

Loading

Copy link
Contributor

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

Looks good to me thanks!

@andrewlock andrewlock merged commit 47f3013 into release/2.x Aug 13, 2024
58 of 62 checks passed
@andrewlock andrewlock deleted the andrew/fix-aspnetcore-bug-v2 branch August 13, 2024 17:32
@github-actions github-actions bot added this to the vNext-v2 milestone Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) identified-by:telemetry type:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants