| Stephen's profileBadCorporateLogoPhotosBlogLists | Help |
|
January 19 Debugging Custom Content Pipeline Extensions (Part 1)The XNA Framework Content Pipeline (Content Pipeline) is a customizable tool included in XNA Game Studio (XGS) for preparing digital content to be used in your games. The XNA Team Blog has an entry here that describes the Content Pipeline, and there are several tutorials and samples on the XNA Creators Club Online web site that explain how to extend the Content Pipeline with your own custom content importers and processors. Although it is easy to add custom extensions, many people find it difficult to debug their custom components as they develop them. In this post, I'm going to explain what makes them so hard to debug, and later I'll provide instructions on how to set up your Visual Studio or Visual C# Express development environment to make debugging them as easy as pressing F5.
A number of people have asked me why they can't hit breakpoints or stop on exceptions in their Content Pipeline Extension Library projects when they debug a game project that uses it. To me, this is a bit like asking why a car doesn't fly when you drive it to the airport. It's hard to answer in a way that will lead to understanding, because I don't know why anyone would expect such a thing. Even though your trip involves flying, you don't fly during every part of the trip. Maybe it's best to start at the beginning. The Start Debugging command does a lot of things. In most cases, developers don't need to know or think about what those things are, because the end result is usually what they want: they get to debug their code. When that doesn't happen, it helps to know what is expected before trying to identify what went wrong. When you press F5 in Visual Studio (the common shortcut for Start Debugging), the following things happen:
There are a number of ways this can be customized.
Okay, now that I've given a summary of what F5 does, let's study a particular example to see why breakpoints in a Content Pipeline Extension Library project are never hit. Let's consider the Custom Model Importer Sample from the Creators Club Online web site. In this sample solution, there are two projects: one Windows Game (2.0) project, called ObjImporterGameWindows, and one Content Pipeline Extension Library (2.0) project, called ObjImporter. When I load this sample project and press F5, the following things are going to happen:
Now that we've covered the whole Start Debugging process in detail, it's a lot easier to answer the original question, "Why don't I hit breakpoints in my Content Pipeline Extension Library project when I press F5?" Answer: Debugging doesn't start until step 8, but the ObjImporter.dll library is loaded up and executed in step 4. When you start debugging in the IDE, you aren't going to hit breakpoints just because they are set. You will only hit them if you debug a process that loads the corresponding binary, and the debugger can find symbols (.pdb file) that says a loaded binary came from that source file. In the case of a Windows game, you don't start debugging until after the game EXE has been built. By that time, the Content Pipeline is already done its work. Since the breakpoints correspond to ObjImporter.dll, you won't ever hit them this way. If you want to debug the ObjImporter.dll as it runs in the Content Pipeline, you need to debug something other than your game project. In my next post, I'll explain how to set up a solution so that F5 will debug the Content Pipeline instead of your game. TrackbacksThe trackback URL for this entry is: http://badcorporatelogo.spaces.live.com/blog/cns!43EB71B104A2D711!165.trak Weblogs that reference this entry
|
|
|