教你50招提升ASP.NET性能(三):使用Microsoft的PDBs调试和分析外部的程序集和库

(3)Use Microsoft’s PDBs to debug or profile external assemblies or libraries

招数3:

使用Microsoft的PDBs调试和分析外部的程序集和库

To accurately debug or profile an external assembly or library (i.e. one you’re not directly compiling), you need the PDB files that accompany each of the DLLs.These files give your debugger or profiler access to information such as function names, line numbers,and other related metadata.
为了精确地调试和分析外部程序集或者库文件(i.e.你没有直接编译),你必须每个DLLs文件都有PDB文件。这些文件给你的调试器和分析器提供了访问比如函数名,行数,和其他本地的元素据。

One thing that sucks in particular is debugging and profiling native Microsoft .NET assemblies without this kind of information. Fortunately, there’s a solution for this very issue. With a little-known feature in Visual Studio 2012 (and 2010 too!), you can connect to Microsoft’s Symbol Servers and obtain most of the debugging symbols for their assemblies and libraries.
一件特别糟糕的事情,在没有这种信息的情况下调试和分析本地的Microsoft .NET 程序集。很幸运,有一种解决方案应对这种非常问题。随着Visual Studio 2012(2010 也一样!)鲜为人知的一种特性,你能连接到Microsft的符号服务器获取到绝大多数的程序集和库文件的调试符号。

Just go to Tools –> Options –> (expand) Debugging –> Symbols, and select the Microsoft Symbol Servers as your source for Symbols.Getting the symbols from Microsoft every time you debug or profile is slow and painful. It’ll even give you a pop-up saying as much once you check the Microsoft Symbol Servers, so be sure to
specify a directory under “Cache symbols in this directory”.
在工具 –> 选项 –> 调试 –> 符号下选择Microsoft 符号服务器作为你的符号源。你调试或者分析每次都要从Microsoft获取符号是很慢而且伤脑筋的事情。一旦你检查Microsft符号服务器,它会给你一个弹层确定是否指定了一个目录用于“缓存符号的目录”。

It will keep a local copy of the PDBs and check for updates every so often. As a result, you get your regular debugging/profiling AND you can see the function names of the Microsoft assemblies.
它会保留一个PDBs的本地备份,经常检查更新。因此你向往常一样调试和分析能看见Microsoft程序集的函数名称。

上一篇:移动端实现弹出框渐显和渐隐效果


下一篇:漫谈“采样”(sampling)