Take note of the Debugger.IsAttached property to find out whether the code is running in debugger or not.
if( System.Diagnostics.Debugger.IsAttached ) { // Do special things (give more info to the development user) Console.WriteLine("Yes, running in debugger"); } else { Console.WriteLine("Not running in debugger"); }
System.Data.dll uses the above feature to debug Stored procedures. Opens a memory mapped file for enabling debugging of sprocs. It issues sp_sdidebug which is used to turn on or off TSQL debugging.
Disclaimer:The code above shows only the features of .NET and in no way suggest/dictates/advices the usage of this particular feature.
Ads by The Lounge