Importing and exporting breakpoints in Visual Studio 2010

In Visual Studio 2010, we have added the ability to import and export breakpoints. There are several scenarios where being able to import/export breakpoints is useful. For example, you can share breakpoints with other developers in your organization.

Example: Hand off bug to another developer

Here is a quick walkthrough that shows how to use this feature. For this example, I’m using the Patient Monitoring WPF sample, shown in the following screen shot. The scenario is that I’m debugging an exception that was reported by my test team. Furthermore, the bug is being tracked in TFS and is currently assigned to me.

 Patient Monitoring solution

To debug the problem so far, I’ve created three breakpoints across two projects, as shown below.

Breakpoints window showing three breakpoints

After hours of debugging, I've now come to a point where I can't make further progress. The method which is throwing the exception is in a class that I’m not familiar with and I need to assign the bug to another developer on the team who is more familiar with that code, so he can investigate the problem further. What I really want is to include all the information about the investigation that I’ve done so far as part of the hand off, including the breakpoints that I used to identify where in the code the problem is occurring. In Visual Studio 2010, I can use the export breakpoint feature to do exactly that.

To the export the breakpoints in my solution, in the Breakpoints window, click the "Export Breakpoints" button on the toolbar as show in the screen shot below.

Export breakpoints via Breakpoints window toolbar button

The format of the file that contains the list of exported breakpoints is XML. Hence, you can save the breakpoints file to any location. Visual Studio 2010 will save the Breakpoints file with a *.xml extension.

Export breakpoints dialog 

Once I've exported the breakpoints, I can attach the breakpoints file to the TFS work item that is tracking the bug and assign it to another developer.

Attach breakpoints file to the TFS work item

After the developer that I’m assigning the bug to receives the work item, he can save the breakpoints file to a location on his machine and then import the breakpoints file in Visual Studio 2010 using the "Import Breakpoints" toolbar button in the Breakpoints window, as shown below.


Now the other developer has the same debugging environment as I do and can start debugging the problem immediately.

By the way, in this example, I showed how to share breakpoints using a TFS work item. However, since the breakpoints file is just a XML file, you can use other means such as email, file share, IM, USB flash drive, etc. to share the breakpoints file.

Importing/exporting breakpoints works for all languages supported by Visual Studio 2010, including unmanaged (C/C++), managed (C#/VB), script, etc.

Habib Heydarian.

Skip to main content