Skip native crash reporting when embedded in Unity - #2231
Merged
Conversation
mono_handle_native_crash prints a large "Native Crash Reporting" banner, dumps native crash info, and walks the managed stack on every native crash. Unity has its own crash reporting and mono's output is just noise and can cause additional crashes that interrupt the Unity handler. Gate the diagnostic section on the embedding host name: skip it when a non-default host name has been set via mono_unity_set_embeddinghostname, which the standalone mono driver never does. Crash chaining (mono_post_native_crash_handler) still runs unconditionally so the host's handler is invoked.
|
|
||
| gboolean mono_unity_embedding_host_name_is_set (void) | ||
| { | ||
| return gEmbeddingHostName != NULL && strcmp (gEmbeddingHostName->str, "mono") != 0; |
There was a problem hiding this comment.
There is another place which checks this, and simply checks for non NULL. That seems wrong. Not saying you need to fix as part of your PR, but the lazy initialization of this value to gEmbeddingHostName does cause some oddity: https://github.com/Unity-Technologies/mono/blob/unity-main/mono/metadata/console-unix.c#L346
joncham-unity
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mono_handle_native_crash prints a large "Native Crash Reporting" banner, dumps native crash info, and walks the managed stack on every native crash. Unity has its own crash reporting and mono's output is just noise and can cause additional crashes that interrupt the Unity handler.
Gate the diagnostic section on the embedding host name: skip it when a non-default host name has been set via mono_unity_set_embeddinghostname, which the standalone mono driver never does. Crash chaining (mono_post_native_crash_handler) still runs unconditionally so the host's handler is invoked.
Release notes
Internal @bill-holmes:
Mono: Skip mono native crash reporting when embedded in Unity