Skip to content

Skip native crash reporting when embedded in Unity - #2231

Merged
bholmes merged 1 commit into
unity-mainfrom
suppress-mono-crash-report-in-unity
Aug 20, 2026
Merged

Skip native crash reporting when embedded in Unity#2231
bholmes merged 1 commit into
unity-mainfrom
suppress-mono-crash-report-in-unity

Conversation

@bholmes

@bholmes bholmes commented Aug 14, 2026

Copy link
Copy Markdown
Member

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.

  • Should this pull request have release notes?
    • Yes
    • No
  • Do these changes need to be back ported?
    • Yes
    • No
  • Do these changes need to be upstreamed to mono/mono or dotnet/runtime repositories?
    • Yes
    • No

Release notes

Internal @bill-holmes:
Mono: Skip mono native crash reporting when embedded in Unity

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.
@bholmes
bholmes requested a review from joncham August 14, 2026 20:48

gboolean mono_unity_embedding_host_name_is_set (void)
{
return gEmbeddingHostName != NULL && strcmp (gEmbeddingHostName->str, "mono") != 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bholmes
bholmes removed the request for review from joncham August 20, 2026 15:17
@bholmes
bholmes merged commit 4ce9836 into unity-main Aug 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants