Window freezes on exit for linux

Hi all,

I’m having an issue with monogame 3.5 compiled with mono 4.6.2, when using the default template in monodevelop the game window crashes on exit, closing via the X button or calling Exit() just freezes things up, the window remains displayed and can only be removed by killing the process. This is only an issue on linux and works as expected on windows with the same versions.

Has anyone else come across this or know of a potential workaround? It looks like not all the spawned threads are being ended correctly (see the console output below).

$ mono --version
Mono JIT compiler version 4.6.2 (Stable 4.6.2.7/08fd525 Mon Nov 14 12:30:00 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            sgen

Console output:

Loaded assembly: /home/steve/mono/Test/Test/bin/Debug/Test.exe
Loaded assembly: /home/steve/mono/Test/Test/bin/Debug/MonoGame.Framework.dll [External]
Loaded assembly: /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll [External]
Loaded assembly: /home/steve/mono/Test/Test/bin/Debug/OpenTK.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll [External]
Loaded assembly: /home/steve/mono/Test/Test/bin/Debug/NVorbis.dll [External]
Thread started:  #2
Thread started:  #3
Thread started:  #4
# Process is killed here via window exit button or a call to `Exit()`
Thread finished:  #2

Looks like threads #3 and #4 are not finished?

This is a known bug, and has been fixed in the development version of MonoGame.

For a workaround you can do something like: Process.GetCurrentProcess().Kill() on OnExit override.

Awesome, thanks for the swift reply!