Last post Mar 04, 2014 04:47 AM by Angie xu - MSFT
Mar 01, 2014 06:06 PM|TheNutCracker|LINK
So I am trying to step into some .NET Framework base class libraries, specifically, "System.Web.DLL". I have checked "Enable .NET Framework source stepping" in my Visual Studio 2013 "Debug->Options->General" dialog box. I have checked "MIcrosoft Symbol Servers"
on the "Debug->Options->Symbols" dialog box. And I have set a breakpoint in one of my "MVC" action methods.
So can I really step through "System.Web.DLL"? Not from what I can tell. It's like somebody is dangling a carrot in front of me making it look like I can get the carrot but it's only a trick. The Visual Studio Debugger(2013) steps into the "Membership.cs"
source code file but then when I try to view the "Locals" it always says something along the lines of ,
"Cannot obtain value of local or argument 'xxxxx' as it is not available at this instruction pointer, possibly because it has been optimized away."
Sure enough, looking at the "Debug->Windows->Modules" window and finding "System.Web.dll" in the list of loaded modules, it shows that the symbols have been loaded and that the "System.Web.dll" module is "Optimized = Yes".
A snippet of text I found on this page:
leads me to believe that actually stepping through "Membership.cs" is just a pipe dream and cannot actually be done in any worthwhile sense. It's in the last paragraph.
" In addition, the Suppress JIT optimization on module load option does not affect modules, such as WinForms.dll, that are created with NGEN."
So, how am I supposed to know what base class libraries(.DLLs) have been created with NGEN? Was "System.Web.dll" created with NGEN? Is it truly steppable in a valuable sense, i.e., with being able to view local variables or is just an illusion? How
do I get the "unoptimized" version of "System.Web.dll" to be loaded so that I can step through it properly?
***** EDIT *****: Can I use "NGEN.EXE" to re-compile or re-assemble "System.Web.dll" myself so that I can step through it in a proper manner, i.e., without it being optimized?
***** EDIT #2 *****: I just noticed that when I step into "Membership.cs" using Visual Studio 2013 F11 key that the little yellow arrow that sits in the left margin of the code window and that points to what should be the next line of code to execute is
actually pointing about 5 lines above where it should be, at a C# comment. A result of the optimzation I am assuming.
Mar 04, 2014 04:47 AM|Angie xu - MSFT|LINK
Thanks for detailed explanation.
Can I use "NGEN.EXE" to re-compile or re-assemble "System.Web.dll" myself so that I can step through it in a proper manner, i.e., without it being optimized?
In the Advanced Build Settings window, under Output, the DLL Base Address field lets you specify the base address to assign to the DLL.)
For these NGEN.EXE issues, it's recommanded to check relevant information about
NGen in Visual Studio, it gives detailed information about how to use NGen.exe and some tips of using NGen.exe.