Visual Studio Debugger-Cannot debug into the .Net Framework source code problem

这是我以前在英文博客中写的,因为国内朋友要看的话会需要vpn,所以我就把它复制了一份到我的这个中文博客中,因为时间问题我没有做翻译处理,请见谅。

 

http://blogs.msdn.com/b/rscc/archive/2010/08/16/net-framework-4-reference-source-is-available.aspx

The .NET 4 file version for this release is 4.0.30319.1.

We can see that the Reference Source for .Net Framework released is for 4.0.30319.1 version. But there're assembly libraries were upgraded while the others were not and stay in 4.0.30319.1. "Unfortunately", the PresentationFramework.dll assembly has been upgrade to 4.0.30319.233. But there's no Reference Source for this version of the .Net Framework.

It is the KB2468871 updated the PresentationFramework.dll assembly to the 4.0.30319.233 version: http://support.microsoft.com/kb/2468871.

So you can not step into the source code in PresentationFramework.dll assembly, the pdb released is 4.0.30319.1 version from Microsoft web site, but we want is the new version 4.0.30319.233 pdb for the Visual Studio 2010 debugging.

So I mentioned Reflector tool, or just view the source code download form the Reference Source web site form Microsoft.

Or maybe you can try to uninstall that update form your environment, but I'm not sure if this can be done and safety enough for your System, I don't recommend you to use this option to solve your requirement, just want step into the source code form Visual Studio 2010.

******************************************************************************

I also have an method can let we use the 4.0.30319.1 version PresentationFramework.dll with the current available version pdb and source code file to let you debug into the .Net Framework source code. But maybe it is not very good enough for your project's stability, since we use one version assembly to debug and test, but with another new version to released the product, maybe there's some places changed in the new version assembly. But I think for learning and practice, this way is the best I can think out in free way.

steps:

1. Backup the PresentationFramework.dll file in "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35", since the Visual Studio will load .Net Framework libraries form this directory, instead of the "Path" property of the reference file in the Visual Studio Solution Explorer.

2. Copy a 4.0.30319.1 version PresentationFramework.dll to the above folder, so that we can let the Visual Studio load the 4.0.30319.1 version library as we expected. (You can find this version PresentationFramework.dll from other Systems or some others web site.)

3. "E:\ReferenceSource\Symbols\SymbolCache\MicrosoftPublicSymbols\PresentationFramework.pdb\59A23BC640434D6795738671BA67F1261\PresentationFramework.pdb: Symbols loaded."(This is my environment, I think you need to find yours from the Modules Window at last time you tried to debug into the .Net Framework source code.)We can find the Symbol loaded form this path from the "Modules" Window when we debug and hit a break point in WPF project, then we need to do is go to that directory and delete the "PresentationFramework.pdb\59A23BC640434D6795738671BA67F1261" directory. This is important to find the Symbols cache and delete them form your disk, so that it will download the correct 4.0.30319.1 version pdb for you.

4. Then we have the old version PresentationFramework.dll file in "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35", and no PresentationFramework.pdb information in the Symbol cache directory.

5. Ensure you have checked the "Enable .Net Framework Source stepping" option. To know how to step into the source code, you can ref this article.

6. And then you can press "F5" to debug your project and step into the .Net Framework source code again.

******************************************************************************

Please do not forget to recover this "C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35" folder content to your new version PresentationFramework.dll assembly which I asked you make a back up.

Have a good day!

posted @ 2011-11-23 16:04  Mike Dos Zhang  阅读(696)  评论(0编辑  收藏  举报