Debugging the content pipeline

Debugging the content pipeline

  • Comments 17

Content pipeline importers and processors run inside Visual Studio as part of building your game. This means you can't just debug into them like you would for normal game code.

Fortunately, the CLR provides a handy way of hooking a debugger up to any managed program you like. You just need to modify your processor code, adding this line at the point where you want to start debugging:

    System.Diagnostics.Debugger.Launch();

Now when you build your game, when the processor hits this line it will pop up a window titled "Visual Studio Just-In-Time Debugger", listing all the possible debuggers that are installed on your system. You will generally want to pick "New instance of Microsoft CLR Debugger 2005", which will connect to your processor and let you debug what is going on during your content build.

  • I havn't tried this yet, but will the standard attach-to-process debbuger also work in this case? (If we attach to devenv.exe?)

  • I get a "No registered JIT debugger was specified." error. Did I miss something in the setup somewhere?

  • Interesting - I though the CLR debugger was included with .NET, but I guess it must not be.

    Looks like you can download it from here though: http://msdn2.microsoft.com/en-us/library/7zxbks7z(vs.80).aspx

  • This doesn't appear to work with C# Express and the Game Studio. I'm trying to make some modifications to the shader code used in the XNA Animation Component Library at http://www.codeplex.com/animationcomponents. I've added the line

    System.Diagnostics.Debugger.Launch();

    to the Process() function of PaletteEffectContent.cs, which is part of the custom importer dll. When I rebuild my project which is set to reference that dll, it just builds as normal. Is that expected behavior?

    Thanks!

    Derek Hauffe

  • I've figured out what I was doing wrong. Thanks for this tip, Shawn!

  • This also does not work for me.  I've done a clean build, removed then added the content file again, everything I could think of.  My debugger line is not getting hit...

  • Just to be complete, the answer was that I am running on Vista, and had elevated the priviledges of VC# Express (run as administrator).  If you do this, the JIT Debugger will not even attempt to attach to the process.

  • I can't get the debugger to attach using Launch(), it just builds as normal and throws an exception during and outputs that exception in the error list. Am I missing something? Also, I'm trying to use a content processor to calculate normals and write them back into the data stream provided... is this allowed/sensible? This content pipeline stuff seems obscenely fiddly just to do something really simple like get access to mesh data and write out new normals...

  • it does not work for me, with GS3.0 and VS2008

  • does not work for express editions...

  • GS 3.1   VS2008 pro

    work perfectly

  • GS 3.1 VS2008 works, but Visual Studio always stops responding afterwards and I have to kill the process and restart.

  • Thank you, great method

  • Doesn't work with VS2010 / XNA4

  • Is there a way to do this in VS 2010 Express?

Page 1 of 2 (17 items) 12
Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post