Calling SoundEffectInstance.Play() only works in debug mode

Hello. I am using monogame 3.2 on Linux Mint 17 using MonoDevelop 4.0.12. I have some experience with XNA. My current goal is to get the basics down in monogame without relying on XNA at all.
I’m using the simplified audio API and loading some testing content using IO streams.

System.IO.Stream stream3 = TitleContainer.OpenStream("Content/Audio/TearsInHeaven.wav");
sound = SoundEffect.FromStream (stream3);

After loading the audio file, I can have it play as expected.

sound.Play ();

However, this does not allow for enough control over the audio playing. An instance can help with that.

soundInstance = sound.CreateInstance();

I then call the play method on it (when the A button is pressed on the controller). It is the method described here: http://www.monogame.net/…

soundInstance.Play ();

This does not work unless I put a breakpoint on the line calling Play() and execute the code in debug mode.

I was hoping someone could help me out here because I cannot figure it out. I must be doing something wroing, but I don’t know what.

I also started looking at the monogame framework code, but I am not (yet) knowledgeable enough about these things to make any real progress. Thanks in advance to anyone who has input, I will also keep looking and report back if I can figure it out.

I have discovered why my code was malfunctioning. As said above, I am starting the song when A button is pressed.

if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)

            {

                Console.WriteLine ("soundInstance.State:--"+soundInstance.State.ToString());    

                if (soundInstance.State != SoundState.Playing) {

                    soundInstance.Play ();

                } else {

                    soundInstance.Pause ();

                }

            }

This (obviously) malfunctions because I do not compare the button state with the previous button state. Due to this, the song starts and stops immediately. I discovered this by writing the states to the console.

Knowing this, it is clear why it worked when putting a breakpoint: it did not give the code the opportunity to detect consequitive inputs.

So yes, I was doing something wrong. It had been too long since I used XNA and I no longer remembered to store the controller state.