none
Debugging .Net APP with Windbg, How to debug C# like in Visual Studio?? RRS feed

  • Question

  • Environment: Win7/8/8.1/10, .Net4.x

    Reference:  https://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx

    Book: C# via CLR

    Tool:SoS,  PssCor4

    I 'm trying to debug C# .Net APP with Windbg , however , it 's so complicated,  So far , i didn't find a way.The way i expect is like debugging in Visual Studio , setting breakpoints in source files and debugger could break and show values with each virable names.

    Howver , in Windbg , no such easy way for users ?? Could anyone shed light on ??

    What i consider is all c# codes are translated into IL , so no straight way to break in accordance with Source code.


    Marcus



    • Edited by MarcusHe Wednesday, March 22, 2017 12:14 AM
    Tuesday, March 21, 2017 5:51 AM

All replies

  • After a log of search , finally , some useful posts are discovered:

    Reference:

    1. http://stackoverflow.com/questions/11768921/breakpoint-set-by-sosex-mbp-or-sosex-mbm-not-working

    2. http://stackoverflow.com/questions/17726879/how-to-view-c-sharp-variables-using-windbg

    With above help and reading windbg help file , C# debugging is available now; here is my basic steps:

    1. download and unzip SOSEX from internet

    2.  launch MyAPP from windbg

    3. set source path and pbd path in windbg

    4. open source file and locate the line you want to break , get the line number at the right bottom of Windbg

    5. In windbg:

         sxe ld:clrjit

         g

         .cordll -ve -u -l

        .load x:\xxx\xx\xx\WhereTheSOSEXis\sosex.dll

        !mdb MySourceFile.cs LineNumber2Break

        g

    6. SUCCESS!!Now we can use !mdso OR !mdv to view the local varibles

    There is still a question in my mind:

    As both are supersets with SOS , what's the difference between SOSEx and PssCor4 ?????


    Marcus

    Wednesday, March 22, 2017 6:34 AM