Process continues after exiting

I have simple blank project other than adding a song to play in the background.

I load the song file at LoadContent, and play it at BeginRun. In my EndRun, I have MediaPlayer.Stop() being called, however, sometimes upon exiting (by pressing Esc), the game does not immediately close (the audio continues to play, and the process continues to exist). It will continue playing for some time until it finally exits on its own.

What is causing the game to continue running even after Exit() has been called?


What MonoGame version?

Running on MonoGame 3.5 on Windows 10.

Even a small app like this:

using Microsoft.Xna.Framework;

namespace Game1
    public class Game1 : Game
        GraphicsDeviceManager graphics;

        public Game1()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

        protected override void Update(GameTime gameTime)

When you run it, it will immediately exit, but you will still see the process running in the background in the task manager indefinitely (run without debugging).

I responded on the issue you opened. This is fixed in a branch that will hopefully be merged before the 3.6 release.

I thought I was alone. I’m currently experiencing this issue but never bothered to report it since I’ve made some serious modifications to the framework in order to start a server a window and graphic adapter. So I blamed myself.

I’m glad it’s already fixed.

Thank you.

Jjagg, is there any way I can get access to that branch? I would like to use that fix before 3.6.
Thank you.

It has been merged, so if you switch to develop your issue will be fixed.

Great news, thank you.

For future reference I made a gist with instructions on how to try out the build or check out a branch for a specific pull request.