Rants, rambles, news and notes from another geek

More Debugging Windows Services

In response to my post about Debugging Windows Services, Jason Bock&nbsp_place_holder;offered the following solution:

Have you tried adding Debugger.Break() into your WinService code? Just a thought - if it works you should be able to stop right at the line of code where you want to start debugging. There may be some caveats with this (e.g. the time limits that are imposed on the onXXX() events) but if you haven’t tried it it’s worth a shot.

Actually, I have used that technique in the past, and you’re right… for debugging code that isn’t otherwise debuggable, this is a reasonable choice. I just don’t really like putting debug logic into my code unless I have to.