Skip to content

Commit

Permalink
display tidy message for failed assertions (#67750)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobsaila authored Apr 8, 2022
1 parent cef4ae1 commit 19475c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mono/mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -6018,11 +6018,17 @@ ves_icall_System_Environment_Exit (int result)
void
ves_icall_System_Environment_FailFast (MonoStringHandle message, MonoExceptionHandle exception, MonoStringHandle errorSource, MonoError *error)
{
if (MONO_HANDLE_IS_NULL (message)) {
if (MONO_HANDLE_IS_NULL (errorSource)) {
g_warning ("Process terminated.");
} else {
char *errorSourceMsg = mono_string_handle_to_utf8 (errorSource, error);
g_warning ("Process terminated. %s", errorSourceMsg);
g_free (errorSourceMsg);
}

if (!MONO_HANDLE_IS_NULL (message)) {
char *msg = mono_string_handle_to_utf8 (message, error);
g_warning ("Process terminated due to \"%s\"", msg);
g_warning (msg);
g_free (msg);
}

Expand Down

0 comments on commit 19475c2

Please sign in to comment.