How to correctly debug Content Pipeline Tool

Hello everyone, i just started using the content pipeline tool and i must say it’s a wonderful addition to the monogame package. Referencing the latest GitHub version i had many crashed or contents unable to build and i would like to give my contribution to fix thoose issues, but i seem to be unable to debug correctly into the exceptions.

My current setup is as follows, starting from the Monogame.Framework.Windows.sln using VSPro2012:

  • added project reference to MGCB from Pipeline
  • created a new configuration for x86 (wanted to use debug and continue where possible) copied from (Any Cpu)

The results are as follows:

  1. launching the Build command doesn’t break into the code of MGCB at set Breakpoints

  2. MGCB throws error in output window but won’t break to show exception

  3. If i turn on Debug Mode app crashes with exception 6100 and asks to connect a debugger (wich displays exception at line 41 of Program.cs

    // Launch debugger if requested.
    if (content.LaunchDebugger)
    System.Diagnostics.Debugger.Launch(); <- Exception

Any help would be welcome ! Thanks!

First off, you should use the AnyCPU configuration for MonoGame, MGCB and your content pipeline projects.

You can bug by opening the project in Visual Studio then running MGCB with the /launchdebugger parameter. This will open a debugger popup where you can select your visual studio instance.

You can find more info about the parameters here:

Thanks for the info, will look into it asap.

Sorry to Necro-Thread, but…

I’m trying to debug a custom processor I’m using within the content pipeline tool. So far, I’ve:

  • built the tool from source,
  • linked it with my project,
  • checked the ‘debug’ box in the build dropdown and
  • placed breakpoints in my custom processor in vs2017

but they’re never hit

I’m obviously missing something. can anyone help?

1 Like

What I am usually doing, is to place a System.Debugger.Lunch() or Break() inside the Processor and run the pipeline tool build (or mbcg). If you have the Processor project already open in VS it will ask you to attach the debugger on the existing VS instance instead of opening a new one.

I don’t think you need to build the pipeline/mgcb or check the debug box from pipeline. That will break inside mgcb.exe, not inside the processor.

pipeline.exe will spawn mgcb on a new process. That’s probably why you don’t see the breakpoints hit.

1 Like

OK, so in another thread, a developer suggests running MGCB from visual studio, but what I’m missing there is how to add my custom processors. I can’t see how to add a .mgcb file to the Tool’s project, and owing to the messy implementation of the XNA code I’ve inherited, I’m not sure how to bring my processors over to the Tool’s project.

I’m done for today. I’ll try to figure this out again tomorrow, thanks nkast.


For anyone who comes back here looking for the solution, I followed these steps:

  • Get the Pipeline Tool Source from Here (Thanks Optimistic_Peach) as suggested on this thread
  • Run protobuild inside the repo’s root
  • Open MonoGame.Framework.Windows.sln in vs2017 (other IDEs are available)
  • Set Pipeline.Windows as startup project
  • Build and Run in Debug configuration
  • Open your custom processors project in a separate vs2017 instance
  • Add System.Diagnostics.Debugger.Break() to the file you want to debug, in the Process() function (Thanks nkast)
  • Build custom processors project in Debug configuration
  • Edit your content project file *.mgcb in text editor, ensure that References all point to Debug *.dll files
  • Enable Debug Mode in Pipeline Tool (in the Build menu)
  • Open your content project file in the Pipeline Tool you’ve run from vs2017
  • Rebuild your content
  • When prompted, attach your Pipeline tool to the vs2017 instance with your custom processors in it
  • Voilà.