Uh oh!
There was an error while loading. Please reload this page.
[NativeAOT] Fix formatting of assertion failures and fail-fasts - #91300
Conversation
ghost
commented
Aug 30, 2023
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFix a long standing TODO. Formatting of assertion failures and fail-fasts in native AOT matches regular CoreCLR with this change. Debug.Assert(false,"Something is not right.");Before: After: Environment.FailFast("Fatal error!");Before: After:
|
MichalStrehovsky
commented
Aug 30, 2023
Btw, can you think of an elegant way to get rid of the first one/two frames that don't have a name because they come from the compiler-generate startup code? I've been thinking of storing the address of Main somewhere and stop the stack walk when it's reached (we'll also need to make sure Main is never inlined) but I didn't particularly liked it so I've never implemented it. |
jkotas
commented
Aug 30, 2023
Maybe we can implement a general support for |
Sounds much better! Moved #91309 from runtimelab and added to 9.0. |
jkotas
commented
Aug 30, 2023
I would like to re-validate it with the fix for #91298 |
janvorli
commented
Sep 1, 2023
I've just found that while coreclr spells it "Unhandled exception", NativeAOT says "Unhandled Exception". May be nice to unify that too. |
Uh oh!
There was an error while loading. Please reload this page.
janvorli
commented
Sep 1, 2023
Actually, there is one more difference I've not noticed before. The coreclr has a period at the end of the "Unhandled exception" while native aot has colon there. |
Fix a long standing TODO. Formatting of assertion failures and fail-fasts in native AOT matches regular CoreCLR with this change.
```csharp
Debug.Assert(false, "Something is not right.");
```
Before:
```
Unhandled Exception: System.Diagnostics.DebugProvider+DebugAssertException: Something is not right.
at System.Diagnostics.DebugProvider.Fail(String, String) + 0x49
at System.Diagnostics.Debug.Fail(String, String) + 0x5a
at System.Diagnostics.Debug.Assert(Boolean, String, String) + 0x2d
at System.Diagnostics.Debug.Assert(Boolean, String) + 0x28
at Program.<Main>$(String[] args) + 0x1d
at test!<BaseAddress>+0x1d3a67
at test!<BaseAddress>+0x1d3af5
```
After:
```
Process terminated. Assertion failed.
Something is not right.
at System.Diagnostics.DebugProvider.Fail(String, String) + 0x49
at System.Diagnostics.Debug.Fail(String, String) + 0x5a
at System.Diagnostics.Debug.Assert(Boolean, String, String) + 0x2d
at System.Diagnostics.Debug.Assert(Boolean, String) + 0x28
at Program.<Main>$(String[] args) + 0x1d
at repro!<BaseAddress>+0x1d51c7
at repro!<BaseAddress>+0x1d5255
```
```csharp
Environment.FailFast("Fatal error!");
```
Before:
```
Process terminated. Fatal error!
```
After:
```
Process terminated. Fatal error!
at System.RuntimeExceptionHelpers.FailFast(String, Exception, String, RhFailFastReason, IntPtr, IntPtr) + 0x335
at System.Environment.FailFast(String) + 0x35
at Program.<Main>$(String[] args) + 0x1b
at repro!<BaseAddress>+0x1d40c7
at repro!<BaseAddress>+0x1d4155
```
Fix a long standing TODO. Formatting of assertion failures and fail-fasts in native AOT matches regular CoreCLR with this change.
Before:
After:
Before:
After: