-
Notifications
You must be signed in to change notification settings - Fork 772
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
[WIP] Automatically get exception message and set to Span.Status #1874
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1874 +/- ##
==========================================
- Coverage 83.77% 83.36% -0.41%
==========================================
Files 187 188 +1
Lines 5967 6139 +172
==========================================
+ Hits 4999 5118 +119
- Misses 968 1021 +53
|
|
||
switch (exceptionRecord.ExceptionCode) | ||
{ | ||
case EXCEPTION_CODE.EXCEPTION_COMPLUS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
activity.SetTag("exceptionRecord.NumberParameters", exceptionRecord.NumberParameters); | ||
activity.SetTag("exceptionRecord.ExceptionInformation", exceptionRecord.ExceptionInformation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual layout of the ExceptionInformation
array is depending on the implementation:
- https://github.com/dotnet/runtime/blob/79ae74f5ca5c8a6fe3a48935e85bd7374959c570/src/coreclr/inc/ex.h#L38
- https://github.com/dotnet/runtime/blob/79ae74f5ca5c8a6fe3a48935e85bd7374959c570/src/coreclr/inc/ex.h#L49
- https://github.com/dotnet/runtime/blob/79ae74f5ca5c8a6fe3a48935e85bd7374959c570/src/coreclr/vm/clrex.cpp#L2156
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExceptionInformation[4]
has different meaning depending on the condition compilation - related to side-by-side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!sos.pe
might give some clue, worst case is that the logic is duplicated in mscordacwks.dll
...
// exceptionRecord.ExceptionInformation[2] == 0 | ||
// exceptionRecord.ExceptionInformation[3] == 0 | ||
|
||
var pClrModuleBase = exceptionRecord.ExceptionInformation[4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This points to the base image address of clr.dll
or coreclr.dll
.
This is a follow up to the previous PR comment.
To play with the current code, use
docs\trace\exception-handling> dotnet run --framework net5.0
.Current thinking:
EXCEPTION_RECORD.ExceptionCode
, if code is0xE0434352
, proceed to step 2, otherwise exit since it is not a CLRException
.EXCEPTION_RECORD
, fetch theSystem.Exception
object (might need to pin the object on GC?).Reference: