Game window goes all white after waking monitors up from sleep

If I have the game running, but am not playing and my monitors go to sleep, my game window (full screen) is completely white once I wake the monitors up and they start displaying again. The game icon disappears from the task bar, but the sound still plays without issue and the application shows as running normally in the Task Manager.

This is on Windows 10, MonoGame 3.6 using Direct X. Any suggestions?

Try upgrading to 3.7.1 and also, this is something you need to test for? pretty sure that is something you have to test for, usually it is a matter of testing each data refresh for an object, if it is not there, you then test for all objects and reload, but that’s just a rudimentary solution… from a previous coding language and platform, but it may work in MG too.

I’m not sure how to detect this outside OS APIs, but I would suggest adding a hotkey that calls GraphicsDevice.Reset() and see if that fixes it when it’s white. Additionally, try subscribing to the GraphicsDevice.DeviceReset event and see if that gets invoked when your monitors are back up. There are several more events you can try that might help here.

Actually, I’m mistaken. Sort of. It’s the PC that is going to sleep (which causes the monitors to sleep). Based on the responses in here it sounds like the GraphicsDevice is lost when the PC goes to sleep? Surely there is a standard way to handle this with all of the games that have been released using MonoGame…?

Are you using true full screen mode? Because if so there will pretty much wont be “any standard way” as it is going to turn into quite a fight that I personally recommend bypassing by never offering fullscreen and opting in for borderless. There are such incosistencies with fullscreen (depending on System, gpu, drivers…) that I really do not recommend it.

Most of the low level GPU handling stuff that XNA framework had are yet to be implemented by monogame.

That includes handling device lost/reset, multiple monitors, device profiles, etc.

Particularly on device lost, that 's the last time it was discussed/reported https://github.com/MonoGame/MonoGame/issues/6265

1 Like

Ok, I understand. I did some more digging… Windows 10 PC has screen power settings set to turn off after a certain amount of time. The PC itself is never set to go to sleep. So, when the monitors go off I’m assuming the graphics card is shutdown and lost. When woken back up the game icon is missing from the task bar, the screen is all white, but the sound is still playing.

I decided to launch my Steam library and see what happens. I couldn’t find a single game that allowed the monitors to go to sleep after the set time. Does anyone know if this is handled by the Steam client or has to be handled by each individual game? Because if Steam itself is overriding the OS setting to shut the monitors off then all of this is a non-issue for me.

Someone expecting Steam to solve his/her issues saddens me.

1 Like

I wasn’t expecting Steam to resolve my issues. It’s not beyond that realm of possibility that the Steam client would prevent the screen from sleeping while a game is running…

He probably meant, you should code for it anyway…

1 Like

Honestly if your monitor is going to sleep, why is the game running still? If it’s absolutely necessary, I’d assume you would handle it in a similar way as if you were going full/windowed mode. I’d probably not worry about even handling sleep mode/monitor off.

Just to add to this discussion, even apps such as Kindle desktop frizz up when resuming from sleep or otherwise a lock screen too, or from being minimised for a long period of time and any combination of the above.