Visual Studio性能分析 - 找不到类库符号

kip*_*oep 14 c# instrumentation class-library visual-studio-2012

我正在尝试使用Visual Studio 2012,.NET 4来检测ASP.NET Web应用程序.该解决方案包含一个Web应用程序和一个类库.问题是我看不到步骤进入类库,我收到一条消息说明:

Matching symbols could not be found. Choose the 'Symbol Settings...' link to add the symbol file location and then reload the report.
Run Code Online (Sandbox Code Playgroud)

分析时的输出看起来很好:

Preparing web server for profiling.
Profiling started.
Instrumenting C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\\bin\PerformanceTest.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll --> C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll
Original file backed up to C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll.orig
Successfully instrumented file C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll.
Warning VSP2013: Instrumenting this image requires it to run as a 32-bit process.  The CLR header flags have been updated to reflect this.
Instrumenting C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\SomeLibrary\obj\Debug\SomeLibrary.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\SomeLibrary\obj\Debug\SomeLibrary.dll --> C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\SomeLibrary\obj\Debug\SomeLibrary.dll
Original file backed up to C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\SomeLibrary\obj\Debug\SomeLibrary.dll.orig
Successfully instrumented file C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\SomeLibrary\obj\Debug\SomeLibrary.dll.
Warning VSP2013: Instrumenting this image requires it to run as a 32-bit process.  The CLR header flags have been updated to reflect this.
Launching web server with profiling.
Launching profilable project.
Warning VSP2355: Some Windows counters will not be collected.  Without this data, some performance rules may not fire.
Profiling process ID 68 (iisexpress).
Process ID 68 has exited.
Data written to C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\PerformanceTest_130801(1).vsp.
Profiling finished.
Loaded symbols for C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\0329cb19\89f716fc\App_Web_0slsprtu.dll.
Loaded symbols for C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\0329cb19\89f716fc\assembly\dl3\62c5c0d2\9777513f_ae8ece01\PerformanceTest.dll.
Profiling complete.
Run Code Online (Sandbox Code Playgroud)

我注意到输出结尾没有说出任何关于名为'SomeLibrary'的类库,其中显示了"Loaded symbols for".

有谁知道为什么我不能检测类库?

这是VS解决方案:http://www.fileswap.com/dl/C9HPd8uEC/

Jim*_*iTh 13

据我所知,您的解决方案中,正在检测的.dll位于类库的"obj"文件夹中.

现在,这可能就是我说话时我应该闭嘴(因为我对Visual Studio探查器没什么了解,我不知道为什么/如果有人想要"obj"二进制文件而不是"bin")因此,我想我最好描述一下我的思路:

VS正在"ASP.NET临时文件"位置中查找符号文件(具体为.instr.pdb文件),因为它是从中加载类库dll的位置.但它找不到它,因为该文件是在类库项目的obj\Debug中创建的,而不是复制到Web应用程序的"bin"文件夹中 - 因此它永远不会将阴影复制到"ASP.NET临时文件"无论是.

从Performance Explorer中删除目标并选择"添加项目目标",检查两个项目,确切地告诉我您(和我)之前的内容:

  • Web应用程序项目中的PerformanceTest.dll ...\bin\Debug
  • Class Library项目中的SomeLibrary.dll是...\obj\Debug

显然,这就是VS想要它的方式,无论它是否有效.它在obj\Debug中检测类库,然后在启动探查器时忘记所有关于新生成的符号.

但是,如果我再次删除"SomeLibrary.dll"目标,请选择"添加目标二进制文件..."并手动选择Web应用程序中的一个...\bin\Debug ...然后开始分析:报告看起来大致相同,但我可以浏览"SomeLibrary",我在输出中得到这个:

Preparing web server for profiling.
Profiling started.
Instrumenting E:\...\PerformanceTest\\bin\PerformanceTest.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   E:\...\PerformanceTest\bin\PerformanceTest.dll -->
   E:\...\PerformanceTest\bin\PerformanceTest.dll
Original file backed up to E:\...\PerformanceTest\bin\PerformanceTest.dll.orig
Successfully instrumented file E:\...\PerformanceTest\bin\PerformanceTest.dll.
Warning VSP2013: Instrumenting this image requires it to run as a 
32-bit process. The CLR header flags have been updated to reflect this.
Instrumenting E:\...\PerformanceTest\bin\SomeLibrary.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   E:\...\PerformanceTest\bin\SomeLibrary.dll --> 
   E:\...\PerformanceTest\bin\SomeLibrary.dll
Original file backed up to E:\...\PerformanceTest\bin\SomeLibrary.dll.orig
Successfully instrumented file E:\...\PerformanceTest\bin\SomeLibrary.dll.
Warning VSP2013: Instrumenting this image requires it to run as a 
32-bit process. The CLR header flags have been updated to reflect this.
Launching web server with profiling.
Launching profilable project.
Profiling process ID 14652 (iisexpress).
Process ID 14652 has exited.
Data written to E:\...\PerformanceTest\PerformanceTest_130810(1).vsp.
Profiling finished.
Loaded symbols for 
   C:\...\App_Web_yzwcgfbx.dll.
Loaded symbols for 
   C:\...\assembly\dl3\928eb82e\75dbb6f1_5695ce01\PerformanceTest.dll.
Loaded symbols for 
   C:\...\assembly\dl3\6c0d460d\5208c7f1_5695ce01\SomeLibrary.dll.
Profiling complete.
Run Code Online (Sandbox Code Playgroud)

这是解决问题的正确方法吗?我再也不知道了.如果没有,可能有一种方法可以让分析器在类库的obj文件夹中查找符号,当它找不到它所期望的位置时 - 或者将.instr.pdb文件复制到bin文件夹的方法-profiling,以便它包含在ASP.NET临时文件的卷影副本中.