Scott Hanselman

Sairama's Interesting Code of the Day

January 22, 2003 Comment on this post [0] Posted in Web Services | Bugs
Sponsored By

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");                  
                        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.

The code above shows only the features of .NET and in no way suggest/dictates/advices the usage of this particular feature.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.