Visual Studio 2015 - Screen stops rendering on any unhandled exception or breakpoint

I’ve recently updated to Windows 10, Visual Studio 2015 (Community edition) and I’m working on a Windows x86 project.

With the game set to fullscreen the screen stops rendering the Visual Studio window on any unhandled exception or manually set breakpoint. Alt-Tab will bring up the task switcher which renders the VS window properly but actually switching to it just results in an all white screen. The system is still responsive, I can force a break with Shift-F5, but I can’t debug anything within VS while the game is running using a breakpoint. This makes debugging an (even more) tedious process.

VS will render normally on an unhandled exception or breakpoint if fullscreen is set to false.

Is there any workaround for this other than commenting out the set to fullscreen line every time I need to debug?

Use a second screen?

Is your computer up to the task of development?

Welcome to the forums by the way…

[NOTE: I tend to be direct with my asking but others are more friendly :slight_smile: ]

While developing I always play the game in a window. If I want to see how it looks like in full screen I press Alt + Enter to toggle full screen.

I use this code in the Update() method

#if DEBUG
	if (keyboardState.IsKeyDown(Keys.Enter) &&
		keyboardState.IsKeyDown(Keys.LeftAlt))
	{
		graphics.ToggleFullScreen();
	}
#endif
1 Like

Add the following line to your constructor

graphics.HardwareModeSwitch = false;

This makes your game run in borderless window mode when in fullscreen instead of exclusive fullscreen and it will solve your problem.

2 Likes

I’m currently using a laptop and currently don’t have a spare monitor (or the desk space for one).
It’s a few years old but should be fine for dev (i7 2.4 GHz, 8GB RAM, Radeon HD 6700M).

@vcRobe My game is being designed for full screen and if I hit a breakpoint the code stops running so I’d have to use this to switch out of full screen ahead of time. It’s good to know the toggle command though, I would like to implement it later when I add more graphics options.

@eddeland Thank you this works, with the mode switch set to false VS still renders on a breakpoint or exception. Ideally later on I would like to add more graphics options to the game to let the user choose fullscreen or windowed fullscreen so it’s definitely good to know that command. For now I’m trying to just focus on game logic and I’ll just leave it set to false to make debugging easier so this pretty much solves my issue.

Thank you all for your input!

All game developers have issues debugging fullscreen games… the best solution is avoid it whenever possible.

You could use Debugger.IsAttached to automatically disable fullscreen when you debug a debug build:

#if DEBUG
if (Debugger.IsAttached)
   DisableFullscreen();
#endif
2 Likes

Sure, that’s why I added that snippet of code in my game because it’s much easier to debug the code in a window than full screen.

I’ve added the #if DEBUG condition because my game when released will be full screen only, but while developing I want it to be in a window must of the time, but from time to time when I want to see how it looks like in full screen then I hit Alt + Enter (or whatever combination you want to switch to full screen).

Thank you @eddeland for that statement. I’ll try it today.