Crash when exit player of standalone windows

My unity version is 2021.3.15f1c1, my project use URP. I build standalone windows player, run it then exit, crash will always occurs。

trace info:

Child-SP RetAddr Call Site

00 0000001a292ff100 00007ffd9675fcb4 ntdll!RtlpWaitOnCriticalSection+0xa6
01 0000001a292ff1e0 00007ffd9675fae2 ntdll!RtlpEnterCriticalSectionContended+0x1c4
02 0000001a292ff240 00007ffd250ea695 ntdll!RtlEnterCriticalSection+0x42
03 0000001a292ff270 00007ffd250f020a mono_2_0_bdwgc!mono_profiler_init_etw+0x8d5
04 0000001a292ff2b0 00007ffd250347c5 mono_2_0_bdwgc!mono_thread_internal_current+0xe3a
05 0000001a292ff2e0 0000012b76e6181d mono_2_0_bdwgc!mono_lookup_icall_symbol+0x29fc5
06 0000001a292ff4a0 0000012b76e61753 0x0000012b76e6181d 07 0000001a292ff530 0000012b75dcebbb 0x0000012b76e61753
08 0000001a292ff570 0000012b75dce893 0x0000012b75dcebbb 09 0000001a292ff600 0000012bd1bd09d3 0x0000012b75dce893
0a 0000001a292ff640 0000012aa6b4183c 0x0000012bd1bd09d3 0b 0000001a292ff6b0 00007ffd25150ba5 0x0000012aa6b4183c
0c 0000001a292ff740 00007ffd25151c5e mono_2_0_bdwgc!mono_callspec_cleanup+0x14e5
0d 0000001a292ff820 00007ffd251521d3 mono_2_0_bdwgc!mono_gc_finalize_notify+0x32e
0e 0000001a292ff880 00007ffd250ed2db mono_2_0_bdwgc!mono_gc_finalize_notify+0x8a3
0f 0000001a292ff8f0 00007ffd250ed4b6 mono_2_0_bdwgc!mono_profiler_init_etw+0x351b
10 0000001a292ffaa0 00007ffd953274b4 mono_2_0_bdwgc!mono_profiler_init_etw+0x36f6
11 0000001a292ffad0 00007ffd967826a1 KERNEL32!BaseThreadInitThunk+0x14
12 0000001a292ffb00 0000000000000000 ntdll!RtlUserThreadStart+0x21

Are you able to share a crash dump from this crash?

i get the dump, but it’s too large to upload, and thank u.

Can you put it in a zip file and then upload to some kind of file share service like google drive?

would you get dump from here?

https://wx.mail.qq.com/ftn/download?func=3&key=c8ce3e3479998517fabd4a343a6234345f7ae03d38623434121e51035b560406520449010101561903025302155a5701041c570d595a05000e04510209073d3454430547504c4655452572fdf9cf955b435abffefe82298ccf538b294a96&code=71d48b44&k=c8ce3e3479998517fabd4a343a6234345f7ae03d38623434121e51035b560406520449010101561903025302155a5701041c570d595a05000e04510209073d3454430547504c4655452572fdf9cf955b435abffefe82298ccf538b294a96&fweb=1&cl=1

Yup!

It seems the crash happens because your code calls Thread.Abort() inside a C# finalizer. Here’s the reconstructed callstack:

000001e06be61c9d() // Thread.Abort_Internal
000001e06be61bd3() // Thread.Abort
000001e068d0f34b() // NetworkLib.NetworkManager.Close
000001e068d0f023() // NetworkLib.NetworkManager.Clear
000001e0ce9d54e3() // NetworkLib.NetworkManager.Finalize
000001df960a183c() // System.Object.runtime_invoke_virtual_void__this__

This is probably a bug in Unity, as we shouldn’t crash like that (if you report a bug, we might fix it). However, calling Thread.Abort() in general is a pretty bad idea. I would use different interrupt mechanisms like System.Threading.ManualResetEvent instead.

Thank u very much. My unity version is updated from 2020.3 to 2021.3. My project is worked well in 2020.3, so i have the question. I will check my code and thank you once again.

Hi, master. It seems difficult to analyse with minidump. Rencnetly i try to use Windbg and Visual Studio to analyse, but not find a way to map addresss to method name. I have read Manual of WindowsDebugging, and tried mono_pmip command in visual studio, but it doesn’t work with minidump. So how do you map addresss to method name. I’m looking forward to your reply.

There is no straightforward/easy way to do it. The way I do it is locate a MonoDomain pointer somewhere on the stack, then look at jit_info_table field. It contains all managed functions in it and it is sorted, so you can do a “binary search” manually. It is tedious but at least allows figuring out what went wrong when everything else fails.

so cool, thanks.:wink: