5

I have created a custom check-in policy as given in the link below:

http://msdn.microsoft.com/en-us/library/bb668980.aspx

I followed the steps as explained by the article. Everything works fine. My doubt is - Is it possible for me to debug the code while check-in the code?

Consider I want to know what are the methods are called inside the CheckForCommentsPolicy class as stated in article or I have added some business logic which needs to debugged. Which process do I have to attach? or Do I have to follow any other approach for debugging?

Is it possible to debug? Kindly help me out.

Thanks in advance

Sathish
  • 869
  • 2
  • 13
  • 28

3 Answers3

3

While MrHinsh's method will in fact work I found that there is an even easier way to debug and would like to recommend that.

If you go to the properties of your checkin policy class project and look under the debug tab you will find a section for Start Action. Select to "Start external program" and browse to where you have visual studio installed.

for instance

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

With this in place and the proper registry keys for loading the policy DLL from your debug folder all you need to do is hit Run and a second copy of VS 2010 will load up and you can debug your class without doing the Debug | Attach to process steps.

Mark Smith
  • 1,085
  • 8
  • 19
2

Yes. You need to have two copies of Visual Studio open. One had your solution open and the other for running the code.

You need to select "Debug | Attach to Process..."

Open the Attach to process dialog
Figure: Open the Attach to process dialog

You can then see all the available process on your computer and you should see the other instace of Visual Studio (this is the one you will use to run your checkin policy).

Attach to the devenv.exe process
Figure: Attach to the devenv.exe process

This will allow you to debug the instance of your Check-in Policy running in the copy of Visual Studio you just Attached to.

  • Hi MrHinsh, Thanks for your comments. But I won't run the visual studio for running the check in policy tool. Actually it is a class library (.dll). This is registred in the windows registry. But my code will be somewhere else. In this case how can I debug it? Please let me know if you further details.. Thanks in advance! – Sathish Sep 16 '10 at 08:49
  • I got an idea from this link:http://stackoverflow.com/questions/2027698/how-to-debug-a-class-library-in-visual-studio – Sathish Sep 16 '10 at 09:19
-1

I got the answer: http://msdn.microsoft.com/en-us/magazine/cc163320.aspx#S3

Sathish
  • 869
  • 2
  • 13
  • 28
  • 1
    This link just takes us to a list of MSDN Magazines -- Please see https://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-not-an-answer – myermian Apr 13 '17 at 20:17