none
Debugging a custom control in Team Foundation

    Question

  • What are the steps to debug a custom control that I have developed for a Work Item in Team Foundation 2008? I need to know as the custom control I have built compiles fine but doesn't work when I bring up the Work Item like I want to.  I want to debug it when I am trying to bring up the Work Item so I can debug it as if a user is using a work item much like an application.

    Debugging the custom control by itself is useless as it is not attached to a work item.

    Thanks in advance for your help.

    Thursday, August 13, 2009 1:49 PM

Answers

  • I have figured out how to debug a custom control for Team Foundation 2008.  I have documented the steps here so it will benefit others who may have or are going through the pain I went through :(.  I hope this helps:

    1.       Open up VS 2008 and load your project.

    2.       Delete all breakpoints in your project.

    3.       Right click on the project and go to the project properties.

    4.       For the configuration, select Active (Debug).

    5.       Under the enable debuggers section, check Enable unmanaged code debugging and enable the Visual Studio hosting process.

    6.       Save.

    7.       Right click on your project and click Clean.

    8.       Right click on your project again and click Rebuild.

    9.       In Windows Explorer, go to debug folder and copy the output (.dll, .exe., etc.) to the C:\Documents and Settings\All Users\Application Data\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0 (this is where TF 2008 WI looks for the .dll and .wicc files).

    10.   On your toolbar with the drop down set to debug, click the arrow.

    11.   You will get a mini screen with your control on it.  There should be a load button.  Click on it and make sure you load the .dll/.exe from the path specified in step 9.

    12.   Leave it open and don’t close anything. Open up another instance of VS2008.

    13.   In Team Explorer, open the Work item type that contains your custom control (Add Work Item-> . . . . . ).

    14.   Go back to the instance of VS2008 in step 1 and go to Debug->Attach to Process.

    15.   In the attach to Process Window, leave the Transport as Default and the Attach To field to have checked managed code and native code.

    16.   In the Available processes window, you will see the process devenv.exe with an ID and the title of the Work Item you just created.  Select that row and click on Attach.

    17.   You will see some processing in the background as it is loading symbols.  Once it is done, set your breakpoints accordingly.

    18.   Go back to your 2nd instance of VS2008 (step 12) and perform what you need to perform on the Work item you created in step 13 to make sure the break point gets hit.

    19.   Once your feel the breakpoint is hit, go back to the 1st instance of VS2008 (step 1 and step 17) and you will see the breakpoints you set hit.  Now all you have to do is debug (sigh!).

    • Marked as answer by VSTf Wannabe Friday, August 14, 2009 8:58 PM
    Friday, August 14, 2009 8:57 PM

All replies

  • I have figured out how to debug a custom control for Team Foundation 2008.  I have documented the steps here so it will benefit others who may have or are going through the pain I went through :(.  I hope this helps:

    1.       Open up VS 2008 and load your project.

    2.       Delete all breakpoints in your project.

    3.       Right click on the project and go to the project properties.

    4.       For the configuration, select Active (Debug).

    5.       Under the enable debuggers section, check Enable unmanaged code debugging and enable the Visual Studio hosting process.

    6.       Save.

    7.       Right click on your project and click Clean.

    8.       Right click on your project again and click Rebuild.

    9.       In Windows Explorer, go to debug folder and copy the output (.dll, .exe., etc.) to the C:\Documents and Settings\All Users\Application Data\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0 (this is where TF 2008 WI looks for the .dll and .wicc files).

    10.   On your toolbar with the drop down set to debug, click the arrow.

    11.   You will get a mini screen with your control on it.  There should be a load button.  Click on it and make sure you load the .dll/.exe from the path specified in step 9.

    12.   Leave it open and don’t close anything. Open up another instance of VS2008.

    13.   In Team Explorer, open the Work item type that contains your custom control (Add Work Item-> . . . . . ).

    14.   Go back to the instance of VS2008 in step 1 and go to Debug->Attach to Process.

    15.   In the attach to Process Window, leave the Transport as Default and the Attach To field to have checked managed code and native code.

    16.   In the Available processes window, you will see the process devenv.exe with an ID and the title of the Work Item you just created.  Select that row and click on Attach.

    17.   You will see some processing in the background as it is loading symbols.  Once it is done, set your breakpoints accordingly.

    18.   Go back to your 2nd instance of VS2008 (step 12) and perform what you need to perform on the Work item you created in step 13 to make sure the break point gets hit.

    19.   Once your feel the breakpoint is hit, go back to the 1st instance of VS2008 (step 1 and step 17) and you will see the breakpoints you set hit.  Now all you have to do is debug (sigh!).

    • Marked as answer by VSTf Wannabe Friday, August 14, 2009 8:58 PM
    Friday, August 14, 2009 8:57 PM
  • great post VSTfWannabe.
    But i was unable to debug the custom control with Visual Studio 2010 Ultimate Beta 2.
    I am having TFS 2010 Beta 2.
    i am trying to debug custom workitem control created for TFS 2010 Beta 2.
    i am stuck on Step 10, where i click on debug and it opens another instance of VS 2010 but the machine freezes.

    anybody here able to proceed beyond step 10?
    or is the debug process different for TFS 2010 Beta 2 and VS 2010 Beta 2.


    Wednesday, January 20, 2010 5:15 AM
  • From looking at your post, I think what you are facing has to do with you running a beta product . . . . .

    I can't tell you if this has to do with 2010 because I don't have it yet.  I would assume the debugging procedures would NOT change between versions of VS.

    Wednesday, January 20, 2010 4:23 PM
  • It worked fine for me in VS2010 RTM. Just a side note: I had to skip steps 10 and 11 (my project is a class library and VS tells me that it is not possible to start such a project).
    Wednesday, September 29, 2010 2:53 PM
  • Thank you very much,

    It worked like a charm in VS2010

    Wednesday, February 09, 2011 4:33 PM