none
Debug info generation RRS feed

  • Question

  • Hi,
    I'm currently working on a very large/slow system.
    If i try to run the entire system in debug mode it wont budge.
    How can i direct the compiler to generate debug info only for those parts i wish to walk threw in the debugger
    and compile the rest in relese?
    Friday, September 19, 2008 6:16 AM

Answers

  • debugging a large system is a pain, needless to say if you can break it into parts and debug those separately, and prefer unit testing to debugging this would save some time.

    However to speed up your current work you can compile the project without specifying a debug build but using the trace option instead.  Check this guide http://msdn.microsoft.com/en-us/library/64yxa344(VS.80).aspx

    #define TRACE 
     
    using System; 
    using System.Diagnostics; 
     
    public class MyClass 
        static void Main() 
        { 
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); 
            System.Diagnostics.Trace.WriteLine("Trace some info"); 
            System.Diagnostics.Debug.WriteLine("Debug some info"); 
        } 
     

    the debug lines are stripped out, step through this code in the debugger and you can see they are not included.  Hope  this helps
    • Marked as answer by Zhi-Xin Ye Thursday, September 25, 2008 10:41 AM
    Friday, September 19, 2008 10:27 AM

All replies

  • debugging a large system is a pain, needless to say if you can break it into parts and debug those separately, and prefer unit testing to debugging this would save some time.

    However to speed up your current work you can compile the project without specifying a debug build but using the trace option instead.  Check this guide http://msdn.microsoft.com/en-us/library/64yxa344(VS.80).aspx

    #define TRACE 
     
    using System; 
    using System.Diagnostics; 
     
    public class MyClass 
        static void Main() 
        { 
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); 
            System.Diagnostics.Trace.WriteLine("Trace some info"); 
            System.Diagnostics.Debug.WriteLine("Debug some info"); 
        } 
     

    the debug lines are stripped out, step through this code in the debugger and you can see they are not included.  Hope  this helps
    • Marked as answer by Zhi-Xin Ye Thursday, September 25, 2008 10:41 AM
    Friday, September 19, 2008 10:27 AM
  • Have you tried debugging in Release mode?  That's definitely one of the coolios about the .NET platform, debugging in Release mode works pretty well.
    Hans Passant.
    Sunday, September 21, 2008 12:01 AM
    Moderator