From 824368bb974f36c02bde63bc90710c0c11ee1437 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 09:21:48 -0400 Subject: [PATCH] [release/6.0] Prevent AV in processinfo2 while suspended on Mono. (#58158) #55379 only fixed CoreCLR. This commit makes similar fix in Mono as well, making sure src/tests/tracing/eventpipe/diagnosticport runtime test pass on Mono. Co-authored-by: lateralusX Co-authored-by: Martin Costello --- src/mono/mono/eventpipe/ep-rt-mono.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/eventpipe/ep-rt-mono.h b/src/mono/mono/eventpipe/ep-rt-mono.h index b42aa10..0324a2c 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.h +++ b/src/mono/mono/eventpipe/ep-rt-mono.h @@ -1855,7 +1855,15 @@ inline const ep_char8_t * ep_rt_entrypoint_assembly_name_get_utf8 (void) { - return (const ep_char8_t *)m_image_get_assembly_name (mono_assembly_get_main ()->image); + MonoAssembly *main_assembly = mono_assembly_get_main (); + if (!main_assembly || !main_assembly->image) + return ""; + + const char *assembly_name = m_image_get_assembly_name (main_assembly->image); + if (!assembly_name) + return ""; + + return (const ep_char8_t*)assembly_name; } static -- 2.7.4