Welcome to MSDN Blogs Sign in | Join | Help

Debugging the content pipeline

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.

Published Wednesday, November 08, 2006 1:13 PM by ShawnHargreaves

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, November 09, 2006 10:01 AM by johnnylightbulb

# re: Debugging the content pipeline

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?)

Sunday, February 04, 2007 12:35 AM by mikeschuld

# re: Debugging the content pipeline

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

Sunday, February 04, 2007 3:17 PM by ShawnHargreaves

# re: Debugging the content pipeline

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

Monday, April 30, 2007 3:09 PM by dubbadee

# re: Debugging the content pipeline

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

Tuesday, May 01, 2007 4:13 PM by dubbadee

# re: Debugging the content pipeline

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

Wednesday, May 09, 2007 1:03 AM by DarylJReed@hotmail.com

# re: Debugging the content pipeline

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...

Thursday, May 10, 2007 7:19 PM by DarylJReed@hotmail.com

# re: Debugging the content pipeline

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.

Wednesday, June 06, 2007 7:14 AM by duncanf

# re: Debugging the content pipeline

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...

Thursday, July 16, 2009 6:32 AM by jbsosch

# re: Debugging the content pipeline

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

Wednesday, November 04, 2009 12:20 AM by locus

# re: Debugging the content pipeline

does not work for express editions...

Sunday, November 15, 2009 12:29 PM by Zakus

# re: Debugging the content pipeline

GS 3.1   VS2008 pro

work perfectly

Tuesday, November 24, 2009 1:56 PM by Chris

# re: Debugging the content pipeline

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

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker