test: add ASP.NET Core blocking detection integration tests - #5578
Merged
jamescrosswell merged 2 commits intoSep 18, 2026
Merged
jamescrosswell merged 2 commits into
jamescrosswell merged 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5578 +/- ##
==========================================
+ Coverage 74.75% 74.82% +0.07%
==========================================
Files 515 515
Lines 18963 18963
Branches 3694 3694
==========================================
+ Hits 14175 14190 +15
+ Misses 3909 3894 -15
Partials 879 879 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jamescrosswell
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @z0rimo - overall, looks good. I made a few comments/suggestions.
z0rimo
force-pushed
the
test/aspnetcore-blocking-detection-5394
branch
from
September 17, 2026 03:32
4a62a14 to
2693b92
Compare
ManualResetEventSlim.Wait spins before it blocks, and only the blocking phase goes through SynchronizationContext.Wait. On a loaded machine the spin phase can consume the whole 25ms timeout, so no wait notification fires and no blocking event is captured — which is why this test failed on six of the seven CI jobs while passing locally. Measured with a standalone probe counting SynchronizationContext.Wait invocations on a thread-pool thread: idle, both primitives hit 50/50; under CPU load ManualResetEventSlim dropped to 44/50 and 41/50 across trials, while ManualResetEvent.WaitOne stayed at 50/50 (250/250 overall). WaitHandle.WaitOne checks IsWaitNotificationRequired and routes through the sync context in shared managed code, with no spin phase, so it exercises the intended path on every platform. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jamescrosswell
approved these changes
Sep 18, 2026
jamescrosswell
left a comment
Collaborator
There was a problem hiding this comment.
Awesome - thank you so much for the contribution and for integrating all my feedback 🙏🏻
I made one small fix to the last unit test you added (hope you don't mind - figured it was quicker than another round of feedback and changes).
3 tasks
This was referenced Sep 21, 2026
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds ASP.NET Core integration coverage for
CaptureBlockingCalls.The tests verify that:
SentryMiddlewareinstances while reusing the sameIBlockingMonitorandTaskBlockingListenerBlockingCallDetectormechanismCaptureBlockingCallsavoids creating the blocking detector services and does not capture a blocking-call eventThis uses the existing
TestServerintegration test infrastructure and does not change production code.Fixes #5394
Testing
The three new tests were also run 10 consecutive times with no failures.