Report unhandled exceptions/FailFast in event log#98152
Report unhandled exceptions/FailFast in event log#98152MichalStrehovsky merged 3 commits intodotnet:mainfrom
Conversation
Fixes dotnet#73998. `EventReporter` is basically taken from eventreporter.cpp in the VM.
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #73998.
Cc @tommcdon @mikem8361 @dotnet/ilc-contrib
|
| _description.AppendLine("unknown"); | ||
| } | ||
|
|
||
| _description.Append("CoreCLR Version: "); |
There was a problem hiding this comment.
CoreCLR?
Don't see a good enough reason to break people who parse this.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/EventReporter.cs
Outdated
Show resolved
Hide resolved
| if (exception != null && reason is not RhFailFastReason.AssertionFailure) | ||
| { | ||
| reporter.AddDescription($"{exception.GetType()}: {exception.Message}"); | ||
| reporter.AddStackTrace(exception.StackTrace); |
There was a problem hiding this comment.
Computing the stack trace is a complicated operation and it is likely to crash again when things are corrupted. The existing console printing code is written in a way so that there is at least something printed to the console in this case, giving people clue what might have happened.
There was a problem hiding this comment.
Moved it after writing to console.
src/coreclr/vm/eventreporter.h
Outdated
| // Maximum size for a string in event log entry | ||
| #define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x8000 // decimal 32768 | ||
|
|
There was a problem hiding this comment.
| // Maximum size for a string in event log entry | |
| #define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x8000 // decimal 32768 |
src/coreclr/vm/eventreporter.h
Outdated
| // shorter in length. Hence, the change in size. | ||
| // An event entry comprises of string to be written and event header information. | ||
| // The total permissible length of the string and event header is 32K. | ||
| #define MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA 0x7C62 // decimal 31842 |
There was a problem hiding this comment.
| #define MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA 0x7C62 // decimal 31842 | |
| #define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x7C62 // decimal 31842 |
| const int MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA = 0x7C62; // decimal 31842 | ||
|
|
||
| // Continue to append to the buffer until we are full | ||
| if (!_bufferFull) | ||
| { | ||
| _description.AppendLine(s); | ||
|
|
||
| // Truncate the buffer if we have exceeded the limit based upon the OS we are on | ||
| if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA) | ||
| { | ||
| // Load the truncation message | ||
| string truncate = "\nThe remainder of the message was truncated.\n"; | ||
|
|
||
| int truncCount = truncate.Length; | ||
|
|
||
| // Go back "truncCount" characters from the end of the string. | ||
| int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA - truncCount; |
There was a problem hiding this comment.
| const int MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA = 0x7C62; // decimal 31842 | |
| // Continue to append to the buffer until we are full | |
| if (!_bufferFull) | |
| { | |
| _description.AppendLine(s); | |
| // Truncate the buffer if we have exceeded the limit based upon the OS we are on | |
| if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA) | |
| { | |
| // Load the truncation message | |
| string truncate = "\nThe remainder of the message was truncated.\n"; | |
| int truncCount = truncate.Length; | |
| // Go back "truncCount" characters from the end of the string. | |
| int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA - truncCount; | |
| const int MAX_SIZE_EVENTLOG_ENTRY_STRING = 0x7C62; // decimal 31842 | |
| // Continue to append to the buffer until we are full | |
| if (!_bufferFull) | |
| { | |
| _description.AppendLine(s); | |
| // Truncate the buffer if we have exceeded the limit based upon the OS we are on | |
| if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING) | |
| { | |
| // Load the truncation message | |
| string truncate = "\nThe remainder of the message was truncated.\n"; | |
| int truncCount = truncate.Length; | |
| // Go back "truncCount" characters from the end of the string. | |
| int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING - truncCount; |
|
cc @Hoyos @mikem8361 |
Fixes #73998.
EventReporteris basically taken from eventreporter.cpp in the VM.Cc @tommcdon @mikem8361 @dotnet/ilc-contrib