Visual C# Developer Center > Visual Studio Forums > Visual Studio Debugger > Stepping into .net framework source and debug output
Ask a questionAsk a question
 

AnswerStepping into .net framework source and debug output

  • Tuesday, November 03, 2009 1:05 PMGiedrius Banaitis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    i've noticed, that .net source code has quite a lot tracing info, like

     

    catch {

    Debug.Fail(

    "Regex error should have been caught in property setter.");

     

    return true;

    }

    etc.
    Is it possible to set up visual studio in such way, that i could receive all those tracing messages to output window or at least file?

    • Moved byRoahn LuoMSFT, ModeratorThursday, November 05, 2009 8:55 AMmove to the correct forum. (From:Visual C# General)
    •  

Answers

  • Tuesday, November 03, 2009 2:34 PMTaylorMichaelLMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Many classes in the framework use standard trace sources to log information.  If you know the name of the source then you can add an entry to your config file to enable the messages just like you would for your own.  Unfortunately most of the sources aren't documented so you'd have to go searching for it.

    Other areas of .NET require some configuration.  ADO.NET, for example, require additional configuration in order to enable logging.  This is also prevalent in performance sensitive code like networking.

    The code you mentioned though isn't tracing code.  It is debug code so if you were running under the debugger and then exception occurred you'd get an immediate assertion.  You don't have to do anything special (other than build in debug mode).  You didn't give the context of the code so I can't figure out from there what exactly you are wanting to enable.

    Michael Taylor - 11/3/09
    http://p3net.mvps.org

All Replies

  • Tuesday, November 03, 2009 2:34 PMTaylorMichaelLMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Many classes in the framework use standard trace sources to log information.  If you know the name of the source then you can add an entry to your config file to enable the messages just like you would for your own.  Unfortunately most of the sources aren't documented so you'd have to go searching for it.

    Other areas of .NET require some configuration.  ADO.NET, for example, require additional configuration in order to enable logging.  This is also prevalent in performance sensitive code like networking.

    The code you mentioned though isn't tracing code.  It is debug code so if you were running under the debugger and then exception occurred you'd get an immediate assertion.  You don't have to do anything special (other than build in debug mode).  You didn't give the context of the code so I can't figure out from there what exactly you are wanting to enable.

    Michael Taylor - 11/3/09
    http://p3net.mvps.org
  • Thursday, November 05, 2009 8:54 AMRoahn LuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello Giedrius,

    Do you really mean the diagnostic messages from server when we step into the .NET Framework source code?
    We could go to Tools -> Options -> Debugging -> General and check the option "Print source server diagnostic messages to the Output window" if we installed SP1 for Visual Studio 2008.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!