I’ve just had a chat with a colleague who was struggling to make one of our installers work.  Which reminded me of the WSS course with Todd Bleeker I was on regarding debugging and quickly trying to debug or attach to stsadm and Studio just isn’t playing.

When you know your going to have to debug some code repeatedly then there is a handy bit of code you can put into your webpart or control receiver event to force debugging to happen here.

Type in the code

System.Diagnostics.Debugger.Break();

So even if you haven’t attached to a process the debugger will ask if you want to launch and will attach and stop at that point in the code. 

Very handy.  Especially when trying to debug Feature Activations and you cant trap the elusive stsadm in the attach process explorer.

Technorati Tags: ,,,
Advertisements