-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[NativeAOT] Fix formatting of assertion failures and fail-fasts #91300
Conversation
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:
|
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.
Thank you!
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. |
Maybe we can implement a general support for |
Sounds much better! Moved #91309 from runtimelab and added to 9.0. |
I would like to re-validate it with the fix for #91298 |
I've just found that while coreclr spells it "Unhandled exception", NativeAOT says "Unhandled Exception". May be nice to unify that too. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs
Outdated
Show resolved
Hide resolved
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 ```
4d26d38
to
3904c81
Compare
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: