XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

How would you prevent a debugger launch upon a fatal error?

Last post 6/2/2009 4:38 AM by Sarnia. 2 replies.
  • 6/1/2009 11:25 PM

    How would you prevent a debugger launch upon a fatal error?

    I'm interested in starting on a game for Windows, but one thing I noticed is that the standalone .exe has a problem with errors. When an error occurs, a debugger appears (for me) that asks to open Visual Studio. If VS is launched, the entire source code of the file that contains the error is displayed. Granted, this shouldn't be a huge problem providing errors are properly handled and the fact that most gamers won't have any debugging application installed, but you never know - in a large program, errors and bugs are bound to be somewhere.

    Also, on an unrelated note, I noticed that you can port games to the Zune using the Xbox 360 Gamepad states, using buttons like A = play button, etc. I'm wondering if anybody has information on that regarding the Zune HD, which (as far as I can tell) is entirely touch-screen.
  • 6/2/2009 1:45 AM In reply to

    Re: How would you prevent a debugger launch upon a fatal error?

    If a program causes an exception that is not handled by the code of that program, this will fall through to the operating system. If the system has a debugger installed, the user will be prompted whether they want to launch it. If no debugger is installed, they get the standard Windows message "this program has crashed" error message.

    The source code is not available even to people who have debuggers, unless you specifically ship that to them along with your executable. You see the source code in your debugger because the source code is (of course) already available on your development computer.

    If you don't want the debugger prompt to pop up, your best bet is either not to have any crashing bugs in your program (highly recommended!  :-)  or if you can't manage that, write your own code to catch and handle exceptions rather than letting them filter out to the OS.

    There are more advanced technologies that try to prevent debuggers in more sophisticated ways (usually available as part of anti piracy software kits) but these tend to be expensive and are not always straightforward to use.
    XNA Framework Developer - blog - homepage
  • 6/2/2009 4:38 AM In reply to

    Re: How would you prevent a debugger launch upon a fatal error?

    Oh, you're absolutely correct. I haven't deployed games to other systems yet so I was just a bit paranoid about why it was opening the source upon an error occurring. Upon reading what your advice, I went to retest this and I noticed that it's calling the actual source files. Without the source, it can't generate anything. My bad.

    And yes, it's probably best to have a program that doesn't have any fatal bugs, but this was more of a "what if" situation.

    Thanks for clearing this up.
Page 1 of 1 (3 items) Previous Next