Skipping EDI in the runtime-async case as well#128735
Conversation
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics |
| @@ -358,7 +358,7 @@ internal void ToString(TraceFormat traceFormat, StringBuilder sb) | |||
| } | |||
|
|
|||
| // Skip EDI boundary for async | |||
| if (sf.IsLastFrameFromForeignExceptionStackTrace && !isAsync) | |||
| if (sf.IsLastFrameFromForeignExceptionStackTrace && !isAsync && (mb.MethodImplementationFlags & MethodImplAttributes.Async) == 0) | |||
There was a problem hiding this comment.
You can move this check to line 240, and update the condition in line 244 to add an !isAsync at the beginning. This way, we can skip some reflection if the method is runtime-async.
There was a problem hiding this comment.
Pull request overview
Suppresses the --- End of stack trace from previous location --- EDI boundary line for runtime-async methods, matching the existing behavior for compiler-generated async state machines. Fixes #128723 where .NET 11 with runtime-async produced a stack trace differing from the .NET 10 baseline.
Changes:
- Extend the "skip EDI boundary for async" condition in
StackTrace.ToStringto also skip when the frame's method hasMethodImplAttributes.Async(i.e. a runtime-async method).
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs | Adds MethodImplAttributes.Async check to suppress the EDI boundary marker for runtime-async frames. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
|
Is it possible to add a test for this? |
|
What EDI is this marker coming from? |
It is from the outer |
|
This change looks fine and seems equivalent to async v1 behavior. But I wonder if the ideal behavior here would distinguish between the user using EDI inside an async method and our infrastructure use of it. For example, would a check for an async thunk method instead of all async methods work for this case? |
In stacktrace pretty-printing we skip the EDI boundary for async methods, so as not to clutter stacktraces with
--- End of stack trace from previous location ---. We should do the same for runtime-async.Fixes #128723