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

.NET CaptureBlockingCalls external code #3940

Open
btecu opened this issue Feb 6, 2025 · 4 comments
Open

.NET CaptureBlockingCalls external code #3940

btecu opened this issue Feb 6, 2025 · 4 comments

Comments

@btecu
Copy link

btecu commented Feb 6, 2025

It looks like CaptureBlockingCalls = true also reports on external code (ASP .NET Core, nuget packages), which is really not actionable:

Image

Is there a way to only capture local code?
Using .NET 9.

@jamescrosswell
Copy link
Collaborator

Hi @btecu ,

The only way to selectively capture blocking calls at the moment is by suppressing it for certain code blocks:

using (new SuppressBlockingDetection())
{
Task.Delay(10).Wait(); // This is blocking but won't trigger an event, due to suppression
}

Does that help in your situation?

@btecu
Copy link
Author

btecu commented Feb 7, 2025

It doesn't, that's not really feasible, is it? Can't edit external packages code which is already compiled anyway to add SupressBlockingDetection.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 7, 2025
@jamescrosswell
Copy link
Collaborator

It doesn't, that's not really feasible, is it? Can't edit external packages code which is already compiled anyway to add SupressBlockingDetection.

It depends whether you're calling the code in the external package explicitly or not. Task.Delay, for example, is from an external package (well, technically from the runtime but it's certainly not my code).

So my question was whether you're seeing blocking calls in external code that is ultimately invoked indirectly by your code or whether that code just "magically" gets run by the framework (which is probably the case for lots of middleware in ASP.NET Core).

@btecu
Copy link
Author

btecu commented Feb 11, 2025

If it was caused by internal code, there would be a line at the beginning of the stack trace where it references the call to say Task.Delay, wouldn't?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Waiting for: Product Owner
Development

No branches or pull requests

2 participants