Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
98 views
in Technique[技术] by (71.8m points)

c# - Cannot step into .NET framework source code

I am using Visual Studio 2013 and have a .NET 4.5.2 project. I have setup my settings according to following page:

http://referencesource.microsoft.com/setup.html

With this setup, I can see that all necessary symbols are downloaded and loaded but I cannot step into a code like the following:

var cookieContainer = new System.Net.CookieContainer();

I am getting a Source Not Available message.

I can step into the following code just fine:

Console.WriteLine("test");

Do you have any idea why I can step into code from mscorlib.dll but cannot step into code from System.dll?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

and have a .NET 4.5.2 project

The version number is your problem. It is a general problem with the Reference Source, Microsoft does not keep it updated well enough to supply source for new framework versions. And more troubling, for security and stability updates. The guys that worked on this are well aware of this problem, they noted this as an issue in their presentation but it has currently, and always had, the status of a // todo item.

It is something you can visualize, first delete System.pdb from your symbol cache (the one in MicrosoftPublicSymbols). Then start debugging your test program, the debugger will retrieve a new PDB from the server. Use Debug > Windows > Modules, right-click System.dll and select "Symbol Load Information". On my machine that looks like:

C:projects2ConsoleApplication407inDebugSystem.pdb: Cannot find or open the PDB file.
C:WindowsMicrosoft.NetassemblyGAC_MSILSystemv4.0_4.0.0.0__b77a5c561934e089System.pdb: Cannot find or open the PDB file.
C:WindowsSystem.pdb: Cannot find or open the PDB file.
C:WindowssymbolsdllSystem.pdb: Cannot find or open the PDB file.
C:WindowsdllSystem.pdb: Cannot find or open the PDB file.
C:empsymbolsSystem.pdbc464b02c2bf04080adcad166dc729c151System.pdb: Cannot find or open the PDB file.
C:empsymbolsMicrosoftPublicSymbolsSystem.pdbc464b02c2bf04080adcad166dc729c151System.pdb: Cannot find or open the PDB file.
SYMSRV:  C:empsymbolsSystem.pdbC464B02C2BF04080ADCAD166DC729C151System.pdb not found
SYMSRV:  http://referencesource.microsoft.com/symbols/System.pdb/C464B02C2BF04080ADCAD166DC729C151/System.pdb not found
http://referencesource.microsoft.com/symbols: Symbols not found on symbol server.
SYMSRV:  System.pdb from http://msdl.microsoft.com/download/symbols: 96985 bytes 
http://msdl.microsoft.com/download/symbols: Symbols downloaded from symbol server.
C:empsymbolsSystem.pdbC464B02C2BF04080ADCAD166DC729C151System.pdb: Symbols loaded.

You can see it searching for the PDB in the normal locations and not finding it. Then contacting the SYMSRV. It first goes to http://referencesource.microsoft.com, as it should, but that server says "not found". And you'll get the copy from the regular msdl server, the stripped one that doesn't have the necessary file + line number debugging info.

There is no clean fix for this, you'd have to downgrade your machine again to the reference source version. Something I cannot do, using Windows 8.1. And should not do, I use VS2013. Redgate's Reflector is an alternative.

I created a UserVoice item for this, it needs a lot more votes.


Update: the Reference Source is now updated to 4.5.2 (March 2015)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...