Game crashing from GPU

This issue is probably local to me but I’ve been trying to fix it for weeks now and there are not many google results left to look through…

  • Monogame
  • On my laptop (Win10, i7 with integrated graphics) game runs fine in windowed and full screen.
  • On my desktop (Win10, i7 with EVGA 1080 ti no OC) game runs fine in full screen, but breaks in windowed.

This error is thrown in windowed mode:

An unhandled exception of type ‘SharpDX.SharpDXException’ occurred in SharpDX.dll
Additional information: HRESULT: [0x887A0005], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_DEVICE_REMOVED/DeviceRemoved], Message: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.

Lets make this more confusing… 1 out of 10 times it won’t throw the error and the game runs fine in windowed mode. I’ve also tried disabling the 1080ti on my desktop in device manager to run under integrated graphics… then everything works fine both in windowed and full screen.

Any ideas on what could be causing this?

  • I’ve changed every setting I could under Nvidia control panel on how the GPU should work with VS2015.
  • I’ve run dxdiag and my DX12 is fine.
  • I’ve purged my SharpDX.dll files from my monogame so they would be rebuilt.

I just saw this post GetData - #12 by MrValentine. I also do a GetData. However, I tried that fix explained c# - Exception in SharpDX.dll - Stack Overflow with no success.

Does the error persist if you don’t call GetData? Which type of build are you targeting (DesktopGL)?

You can subscribe to the DeviceLost event for your GraphicsDevice and identify when it’s throwing this. Is it at the start of the game, or when the user does something?

1 Like

Sorry for the delay.

I subscribed to the devicelost event and here is the output in the terminal

D3D11: Removing Device.
Exception thrown at 0x00007FFE3C874008 in Pendragon.exe: Microsoft C++ exception: _com_error at memory location 0x000000D8147FC348.
Exception thrown at 0x00007FFE3C874008 in Pendragon.exe: Microsoft C++ exception: _com_error at memory location 0x000000D8147FDE60.
Exception thrown at 0x00007FFE3C874008 in Pendragon.exe: Microsoft C++ exception: _com_error at memory location 0x000000D8147FE198.
An unhandled exception of type ‘SharpDX.SharpDXException’ occurred in SharpDX.dll

With no success…

  • I’ve now reinstalled DirectX from Microsoft
  • I’ve tried some RegEdit stuff dealing the GPU
  • Uninstalled VS2015 and Monogame, then resinstalled them

I should also note this happens even in a new MG project. Oddly, Stardew Valley starts up fine. I’m about ready to reinstall windows 10

Well I took the plunge and re-installed Windows 10. Now it is working again.

I’ll mark it as solved. Sucks nothing else worked.

Nevermind, it is happening again. With a fresh install of Win10, Nvidia drivers, monogame and VS2015.

It worked up until Windows 10 received its updates or it was after I reinstalled my VR (vive) stuff. They both happened at the same time. WTF.

Have you tried, I don’t know, removing the Vive stuff?

I would suggest trying to unplug the Vive if you haven’t, as MrValentine suggested. Check which graphics adapter it’s using and if it supports your profile. Does the error only occur if you have the GetData call?

This error indicates that the GPU driver itself has reset, but not why. If it’s happening on only one PC and even on new projects, it could actually indicate an overheating problem or hardware fault on the GPU. Have you tried underclocking the 1080TI a bit and seeing if that helps? And do GPU benchmark programs run fine or crash?

I have a player who is getting that exact crash and his crash reports are baffling. It happens frequently but intermittently and always in VertexBuffer.GenerateIfRequired, and he’s using a laptop with an integrated intel HD chip and an Nvidia mobile GPU. I suspect NVidia Optimus is switching off his GPU and SharpDX doesn’t handle it correctly, but since it’s literally just that one player I am beginning to suspect that he might just have a hardware fault.

The GPU is a month old and runs all other games without problems (no overheating or crashes). I run Fallout VR without issue (no overheating). The card is not OC’ed but I will try under clocking it when I get home from work. I’ll look into all the things tonight that you mentioned and NVidia Optimus.

I’m also going to look into my MSI mobo bios and how it is setup to handle the graphics controller. Maybe two are defined and NVidia Optimus is switching.


Force the 3D GPU, leaving it to automatic means it is probably switching mid code…

1 Like

Did you try enabling the DirectX Debug Layer as described in the GetData thread? Did it report anything?

Yes I did. The information gathered is in the #3 post in the topic.

If we’re talking about setups with Nvidia Optimus, you can’t target the actual GPU directly. It doesn’t have access to draw to the screen, so the screen will be black if you target it directly. This shouldn’t be the problem here though as Optimus is a laptop thing and it’s his desktop that gets the crash.

Awkward… but the Desktop, does it have an enabled internal GPU as well?

He answered this in the original post where he said he disabled the GPU to run it on the integrated chip and everything ran fine. My suggestion would be to switch the integrated chipset off entirely and see if it runs fine with just the 1080TI enabled, though this really shouldn’t make a difference as gpu-switching shouldn’t be happening on a desktop.

The DXGI_ERROR_DEVICE_REMOVED crash has been reported for years by people on games ranging from indie to AAA, and there’s no consensus on a solution. Some people found underclocking solved it, some said it was caused by a bitcoin-mining virus, but most just can’t ever fix it. One of my players has this persistent issue, he’s sent in hundreds of DXGI_ERROR_DEVICE_REMOVED crash reports and I am running out of ideas on how to help him.

Not sure why it is working, maybe someone can explain it? I think I solved the issue I was having. I wanted to share in case others need this information. When I started my game, I was on Win7 with C# 4.5. My laptop was always Win10 and it always worked. My PC was Win7 and I upgrade to Win10 for my Vive and the game stopped. The other thing I did at that time was change my game build to C# 4.6.1 which worked on my laptop, so I never thought it would be an issue.

I compared my game application to a newly created monogame application in Win10 and looked for any subtle difference. I found one. The app.manifest file was removed. Not sure why, I don’t ever recall removing it. Once I added it back in, the game starts without GPU issues. If I remove it, the game won’t start properly.

Also I can’t edit the topic title to mark it solved, otherwise I would.

1 Like