XNA Content Pipeline Debugging (4.0)

It took more work than I expected, but I’ve published my template for debugging the XNA Content Pipeline in XNA Game Studio 4.0.

To install and use the template, right-click on the solution node of a solution where you have an XNA Content project to debug, and select Add—>New Project… Then, in the Add New Project dialog, click Online Templates on the left-hand-side, and type “debugging” in the search box in the upper-right corner.


Select the XNA Content Pipeline Debugging template, and it will start the install wizard. The template is released under the Microsoft Public License. (When I submitted to the VS Gallery, I discovered that all submitted templates must be licensed under the Ms-PL.) If you don’t agree to the license, do not install or use the software.

After creating the project, there are two string constants that you must edit before you begin debugging. They are marked with comments, but I’ll describe it here as well.

Replace the highlighted value of this first field with the full path of the content project you want to debug:

    private const string ProjectToDebug = @”TODO_FullProjectPathGoesHere“;

Then replace the highlighted value of this second field with the relative path of the item you want to debug. The path should be relative to the content project, so that it matches the item name in that project.

    private const string SingleItem = @”TODO_RelativeItemPathGoesHere“;

Now when you want to debug, you set the DebugPipeline project to be the startup project and press F5. Or, even better, just right-click on the DebugPipeline project and select Debug—>Start new instance.

By default, this project is configured to build content for Windows using the Debug configuration and the HiDef graphics profile. These settings will be apparent in the Program.cs file where you can change them to meet your needs.

Changing the graphics profile to Reach is easy, and you might need to do this if your content project is part of a Windows Phone game.

HOWEVER, for now please don’t change the TargetPlatform (I just discovered a bug as I’m writing this… Damn!). I’ll update the template tomorrow to fix the problem.

If you have feedback or questions about the template, or want to review screenshots before downloading, follow this link to the template description page in the Visual Studio Gallery:

XNA Content Pipeline Debugging

The link above has a discussion page.

About badcorporatelogo

My name is Stephen Styrchak, and I work as a software developer in Seattle, Washington, USA.
This entry was posted in Programming, XNA Game Studio. Bookmark the permalink.

20 Responses to XNA Content Pipeline Debugging (4.0)

  1. Expandable says:

    You do realize that you can always put a Debugger.Launch() into your custom importer and debug it right away? If so, what’s the benefit of your approach?

  2. Erzengel says:

    I always just launched another visual studio and used Attach To Process to attach to the visual studio that would do the building. This will probably make debugging a much smoother process, thank you.

  3. Evan says:

    Works great and I agree rebuilding to debug is not the way to go through development, especially when I feel I spend about 80% of my development in the content pipeline. Now I can remove the 10 or so commented out Debugger.Launch() ‘s in there. Thanks man!

  4. Pingback: News from the XNA team « Sgt. Conker

  5. Zman says:

    Great, works with the Express edition, Thank you

  6. Thanks for this, it’s really helpful. On a related subject, I’m having a trouble attempting to debug a custom MSBuild task (using VS2010 Express).

    Will Debugger.Launch() work from a custom task once I install the Windows SDK, or is there a more elegant solution similar to what you’ve done here?

  7. Awesome, works like a charm. Seems obvious now that you mention it.

  8. Eric Cosky says:

    A bit late to the thread, but thanks for this very helpful extension.

  9. Kristafer Vale says:

    I’m sorry,

    I’m a bit thick, I’ve followed these instructions but don’t seem to understand, how can I use it to debug the content pipeline? Does this allow me to set breakpoints and inspect data inside the content Processor? I seem to get the same exact exception and no additional data or functionality using this method.

    What I was hoping to be able to do is, inside of my CustomContentProcessor, I’m parsing some .xml but I’m getting a Input string was not in the correct format error. I’d like to print the xml node that is causing this error to the output window with something like System.Diagnostics.Debug.WriteLine(xmlNode);

    but obviously this does nothing in the content processor. I thought I might be getting something like that functionality from this method you’ve developed here, but I’m lost how to actually use it. I am extremely N00B at debbuging, so I appologize if this is something super simple.

    Any additional help would be much appreciated!


  10. Extron - TBJ says:

    Very nice solution! In my opinion Microsoft should develop some method for easily debugging content, since that is where a lot of errors can arise, especially when dealing with custom content. I prefer this solution over others that I have found for its ability to keep my code clean, without needing to call any methods that should not be in there in the final build.

  11. Tom Looman says:

    Thank you for this🙂 I was about to post an issue where it didn’t work for me, and of course it magically worked right as I was typing it…

    This should prove to be a tremendous time-safer when creating new processors, Debugger.Launch() takes a lot of time and is very sub-optimal, especially compared to this.

  12. Iain says:

    Thanks for providing this! Worked first time for me and helped me track down a bug in less time than it took for VS to install the template.

  13. Pingback: Progress Update – Mar 14th – World Reversed

  14. Luke Rissacher says:

    Hey Stephen –

    This blog post is pretty old so I imagine I’m pushing my luck here with a tech question – anyway I had been using your template successfully for quite a while, to debug and step through a custom model processor – it’s been a huge help for me, major kudos for posting it.

    Anyway after a year or so and after switching PC’s, it doesn’t seem to hit the breakpoints in my content processor anymore – the pipeline debug project appears to run successfully, 0 warnings, 0 errors, but the breakpoints in the content processor never get hit.

    When I analyze the logging output, I don’t see any messages about the specific content item I’m debugging; it compiles the content project, which compiles the custom pipeline project and its dependencies, but appears to skip the model entirely. I’ve tried making small changes to the model to “mark it dirty”, made sure all the pipeline project debug settings were correct, etc. The SingleItem configuration property also appears correct, if I change the path at all I get an error right away.

    Anyway – don’t want to bother you too much with this – if any quick and obvious thoughts come to mind about why the content item doesn’t seem to be getting built, or some other reason why the processor breakpoints aren’t getting hit, let me know.


  15. Luke Rissacher says:

    OK, after composing a long-winded question, I stumbled on the solution to my own problem.

    For anyone having a problem with the target content item never getting built during the pipeline debug process (the item specified by the SingleItem property), make sure to use backslashes instead of forward slashes there.

    E.g., in my case this appeared to run fine, 0 warnings 0 errors:

    private const string SingleItem = @”Models/MyModel.fbx”;

    But actually never invoked the content build. Instead this line did the trick:

    private const string SingleItem = @”Models\MyModel.fbx”;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s