Skip to content

fix: Null reference exception in Asp.NET Core 6+ browser monitoring injection. #3102

Merged
tippmar-nr merged 3 commits intomainfrom
fix/aspnetcore-browserinjection-bug
Apr 17, 2025
Merged

fix: Null reference exception in Asp.NET Core 6+ browser monitoring injection. #3102
tippmar-nr merged 3 commits intomainfrom
fix/aspnetcore-browserinjection-bug

Conversation

@tippmar-nr
Copy link
Copy Markdown
Member

@tippmar-nr tippmar-nr commented Apr 17, 2025

In some cases, neither of the instrumentation wrappers for Asp.NET Core 6+ will be hit (for example, when OpenAPI and Swagger is configured), which means that no transaction will be created and can result in a null reference exception.

Also updates the pipeline that executes the browser injection wrapper to check for a valid transaction, which will keep the wrapper from running when there is no transaction.

Fixes #3101

@tippmar-nr tippmar-nr requested a review from a team as a code owner April 17, 2025 15:19
jaffinito
jaffinito previously approved these changes Apr 17, 2025
Copy link
Copy Markdown
Member

@jaffinito jaffinito left a comment

Choose a reason for hiding this comment

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

Smallest PR ever?

@tippmar-nr tippmar-nr requested a review from jaffinito April 17, 2025 16:49
@tippmar-nr tippmar-nr merged commit 49df7bf into main Apr 17, 2025
99 checks passed
@tippmar-nr tippmar-nr deleted the fix/aspnetcore-browserinjection-bug branch April 17, 2025 19:15
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.28%. Comparing base (bd9ef4c) to head (2fdc2cb).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3102      +/-   ##
==========================================
- Coverage   82.33%   82.28%   -0.06%     
==========================================
  Files         477      477              
  Lines       30636    30636              
  Branches     3424     3424              
==========================================
- Hits        25225    25208      -17     
- Misses       4609     4626      +17     
  Partials      802      802              
Flag Coverage Δ
Agent 83.34% <ø> (-0.07%) ⬇️
Profiler 72.51% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Agent/NewRelic/Agent/Core/Agent.cs 75.13% <ø> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NewRelic Agent 10.40.0 with Azure Functions breaks Swagger

4 participants