Auto-detect new crashes

Aug 20, 2015 at 2:56 PM
Hello everyone :)

We would like to know if there is a way to Auto-Detect new crashes, and ideally saves the last 30 seconds of video, using the XboxConsole API?!

Thanks and cheers,
-Steve
Coordinator
Aug 22, 2015 at 12:17 AM
Without attaching a debugger, the only way to accomplish what you're after is through an unhandled exception filter in your game. The basic problem is that you need the game to halt on crashes so that the device doesn't dump the DVR buffer.

Once you've caught the unhandled exception, you have a couple of options:
  • You can capture the last x seconds of video to disk right there
  • You can signal another app (on a PC, probably) that it needs to call XboxConsole.CaptureRecordedGameClip()
The other option to consider is to actually attach Visual Studio to the running game. Visual Studio will catch any unhandled exceptions, giving you an opportunity to call the XboxConsole API manually. There are ways to automate that process as well, usually through including the debugger libraries in a standalone tool.

Hope that helps!
Aug 24, 2015 at 1:17 PM
Hello and thanks very much for your answer, really appreciated.

Unfortunately, attaching Visual Studio isn't an option as we want to avoid installing VS on every testers' PC.

I would have a question here: Does "through an unhandled exception filter in your game" need the Devs to be involved? Is this something they need to add in the game's code or this is something we can caught using any command-line debugger or API (as like KD or CDB)?

Thanks again :)
Coordinator
Aug 25, 2015 at 11:50 AM
Edited Aug 25, 2015 at 12:05 PM
The unhandled exception filter approach would indeed require modification of the game's source.

I believe you can connect a command line debugger to a running title and catch unhandled exceptions. Unfortunately, I couldn't find public documentation on how this is done. I'll look around a bit more and respond if I'm able to find anything. You may want to work with your devs and determine if they're doing any command line debugging currently.

EDIT:
If you can get to it, this link provides some details on connecting other debuggers:
https://developer.xboxlive.com/en-us/platform/development/documentation/software/Pages/atoc_kd_aug15.aspx
Aug 25, 2015 at 5:29 PM
Edited Aug 25, 2015 at 5:29 PM
Hi and thanks again for your answer :)

We will ask the devs if they can add the Unhandled Exception filter in order to make KD connects to it... All our devs use VS to debug, which we want to avoid for our testers. At the moment KD says "Waiting to reconnect..." so I believe the Unhandled Exception filter isn't implemented.

We thought about a Timer that would check the Title's crashdump partition every 1-2 seconds for a new crash.. then takes the video... but we are a bit scared that it would be to heavy performance wise.

We will post here as soon as we can go forward :)
Aug 31, 2015 at 3:54 PM
Hi,

Our tool is finally able to detect new crashes, with a 2 seconds timer, and than takes a 2 minutes video. Unfortunately, the title terminates itself after a little while, which stops the download of the Crashdump. However, we have notice that if we "Capture debug output" from the Xbox One Manager, the title doesn't terminate by itself after a while... So we would like to implement a StartDebug() and StopDebug() in our code for when it detects a new crash.

I can see in the doc that XboxConsole is capable of doing it, but I can't find it while coding.

Your help is really appreciated :)

Thanks
-Steve
Coordinator
Sep 2, 2015 at 11:32 PM
I'm not sure what you mean when you say you can't find it while coding. You need to get an XboxProcess object (sample code here: https://xboxconsole.codeplex.com/documentation#_Toc418760324). Once you have a process, you can subscribe to the TextReceived event. Your handler for the event can do whatever you like (echoing the text is pretty common).

Essentially, your StartDebug and StopDebug methods translate to subscribing and unsubscribing to the TextReceived event. As to whether, maintaining that subscription will prevent a crashed title from terminating, I can't say. It's not something I've tried before.