I'm using XNA 3.1 ( .NET 3.5 ) and my program closes without any warning, errors, or code instructing it to do so. I looked in the output, and there aren't any obscure messages outside of telling me that certain modules had been loaded and the program was optimized. FURTHERMORE, this doesn't occur on my own personal computer. It only happens on my school computers and my mom's laptop which makes me wonder if there's a hardware issue ( ? ). The schools run Windows XP, and the laptop runs Windows 7. Both of them have the full SDK installed, so it's not a dependency problem. Does anybody have any advice for this?

Sometimes it will run for 2 seconds. Other times it will run for about 10. Sometimes if I rebuild it enough times, it runs and doesn't crash ( or rather, the "countdown" was severely extended somehow. I don't really know. )

( I would post code, but since I have absolutely no clue where my code is doing stuff wrong, that's kind of a challenge ).

  • 1
    \$\begingroup\$ Surrounding the main loop in a try/catch should get any unhandled errors. You could then look at the stack trace to find the source of your issue. It's likely either a race condition or as you say, a graphics hardware issue. \$\endgroup\$
    – House
    Apr 27, 2013 at 20:44
  • \$\begingroup\$ The thing is -- I don't have access to the Main loop. XNA Defines that for me in the main Game class, and I'm pretty sure it's not a virtual function. \$\endgroup\$
    – Full Metal
    Apr 27, 2013 at 22:02
  • 2
    \$\begingroup\$ @FullMetal In your Program.cs file (as per the template), you can wrap game.Run(); in a try/catch block to the same effect. \$\endgroup\$ Apr 28, 2013 at 7:39
  • \$\begingroup\$ I have tried, and there is still no exception being thrown that I can detect. \$\endgroup\$
    – Full Metal
    Apr 30, 2013 at 14:59

1 Answer 1


This kind of rapid exit is sometimes from calling a driver with invalid data, or for abilities it just can't do.

Assuming that you're in visual studio, find the Debug-Exceptions menu and temporarily turn on all the system ones.

Also also, check all function returns because, just because. Be paranoid whenever calling the system. While you're doing that, check all device caps to verify that the hardware you're running on has features that your code expects.

And finally, try using the debug version of DirectX/D3D (which gives a ton of extra console status output).

  • \$\begingroup\$ Mm...I don't think I have any references to DirectX/D3D. Nor do I have any calls to system that I'm aware of ( Unless it's done in JigLibX ). I tried turning on all system exceptions on throw and on uncaught, nothing arose. :\ \$\endgroup\$
    – Full Metal
    Apr 27, 2013 at 21:54
  • \$\begingroup\$ Additional resources: check the event logs in your windows administration panel. Strip features out of your code until it doesn't crash. Go old school and add debug console print statements to trace program execution before the crash. Take a look at the exception handling section at MSDN, you may read something that helps. More hardcore is to install msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx and play around, I don't remember what the learning curve in windbg is anymore. \$\endgroup\$ Apr 27, 2013 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .