Question

Sorry if this is a duplicate, and from what I see it's not possible. But in any case is it possible to attach source for C# with windows debugger with correct symbols? I know we can use !name2ee for putting breakpoints on different functions, but is there a way to actually step through C# code like vb or C++ ? Or are there are alternatives to achieve the same?

Was it helpful?

Solution

Unforturnately not possible with Windbg (or ntsd or cdb). Please see this old thread from the old microsoft.public.windbg news group back in 2008 with subject line "No CLR support in the latest debugger release". A Microsoft employee talks about the history and reasons for this and interestingly how a version of windbg slipped out accidentally that actually had this capability (and then later removed). Here's the link: https://groups.google.com/forum/#!topic/microsoft.public.windbg/A1MKBkM3L2Y

OTHER TIPS

There is a command for loading the symbols, but I do not remember what it is. As I remember you need both the pdb and the source to get it to work.

If you have the code and want to step through why not use Visual Studios? You can download the express version for free. Also, Visual Studio's will allow you to attach to an already running process if you need.

Not as convenient as the unmanaged source code stepping, but maybe ok.

.symfix x:\symbols
.sympath+ x:\mypdbs
.srcpath x:\mysource
.reload
.loadby sos mscorwks;.loadby sos clr
.load sosex; *** Download SOSEX, use full path if necessary

Then open source code, File/Open Source File (Ctrl+O).

!mbp MySourceFile.cs 77; *** 77 is the line number
g

Wait until the breakpoint is hit, then try

!mt; *** managed step into
!mgu; *** managed go up
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top