Hi folks
I found that someone still does not know the technique I’ve been using for ages.
The technique is used when I want to set a breakpoint to debug some problematic code and find it too difficult to start debugging or attach it to the appropriate process
Just put the following snippet into a problematic code. Then recompile and copy resultant exe/dll to the proper location.
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
First line triggers the UI dialog to attach debugger. Second line stops as on a breakpoint.
Some authors suggest to use only one of these lines but the behavior is not very reliable. That’s why I use both of them at the time.
This technique is brilliant for debugging things like Visual Studio plugins or custom MSBuild tasks