graphics.ToggleFullScreen() freezes game

I am trying to learn a bit more about resolutions in game projects.

All I have basically done is loaded a texture up, playing around with scaling up the PreferredBackBufferWidth/Height

I can toggle the game full screen using graphics.ToggleFullScreen(); just using a key press to toggle it.

It goes full screen fine but coming back from it causes it all to freeze up.

I have tried it simply without even loading or drawing anything and even checked for key down/up states to make sure it just wasnt being called loads of times.

Am I doing something simply wrong?

Did you check that the device is not lost when going back to windowed mode ?

Managed to see beyond the freezing that I got a SharpDX error with:


Which means invalid parameters passed in, so perhaps I am losing the device.

How can I check/avoid it?

Breaking just before it toggles again, both my graphicsdevicemanager and graphicsdevice are there as normal.

You can check it using 2 ways:


Or branch your own event onto the


event handler.

Concerning your issue, you could also use


To see what is in, I’ve just discovered a minute ago when I looked into my code and using Intellisense as i did not remember the exact names.
Do you still get the error even when not clearing anything, as if there were no code in draw/update ?

yea with an empty draw with and without base.Draw still does it.

Its funny I am sure this worked before:

graphics.IsFullScreen = !graphics.IsFullScreen;

but it does the same thing too, freezing.

Just to clarify, it goes full screen fine but its coming back that does it.

Did you also remove all from update() excepted keys handling ?

(Why people always think others read their own mind ? Does the X-Men world is already ours now ? :confused:)

which platform ? which MonoGame version ? Be specific if you want to be helped.

FYI I tried in update on a little sample I’m working on adding this:

if (keyboardState.IsKeyDown(Keys.F1) && prevkeyboardState.IsKeyUp(Keys.F1))
                graphics.IsFullScreen = !graphics.IsFullScreen;

Fullscreen mess up with mouse controlled crosshair but going back to windowed mode works and game continue to work as before, even playing with the F1 key didn’t create any issue with my own sample. There is even no message from SharpDX (sometimes there are harmless exceptions but not even a single one here).

MG 3.5.1, Windows platform, win 7 64b with a Geforce GTX 780M wih not so up to date drivers, game build with debug/x64

Sorry was trying to be minimal as to not clutter or confuse the question.

Windows 7 x64 machine.
Radeon R7 260x
Same debug/x64 build.
latest MG and extended.
Windows target.

I may try a driver update later at home. I was honestly thinking nothing hardware wise and thought I was just doing something stupid code wise.

My game has settings-menu, where you can toggle fullscreen on/off.

This works for me:

graphics.IsFullScreen = true;
graphics.IsFullScreen = false;