gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 07:54:28 25 4
gpt4 key购买 nike

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

Matching symbols could not be found. Choose the 'Symbol Settings...' link to add the symbol file location and then reload the report.

虽然分析时的输出看起来不错:

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.

我注意到输出最后没有说明名为“SomeLibrary”的类库的任何信息,它显示“已加载符号”。

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

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

最佳答案

据我从您的解决方案中得知,正在检测的 .dll 位于类库的“obj”文件夹中。

现在,这可能只是我在应该闭嘴的时候说的(因为我对 Visual Studio 探查器知之甚少,而且我不知道为什么/如果有人想要检测“obj”二进制文件而不是“bin"),因此,我想我最好描述一下我的思路:

VS 正在“ASP.NET 临时文件”位置寻找符号文件(特别是 .instr.pdb 文件),因为这是它从中加载类库 dll 的地方。但是,它不会找到它,因为该文件是在类库项目的 obj\Debug 中创建的,并没有复制到 Web 应用程序的“bin”文件夹中——因此它永远不会被复制到“ASP.NET 临时文件”中要么。

从 Performance Explorer 中删除目标并选择“Add Project Target”,选中这两个项目,我得到的正是您(和我)之前拥有的:

  • Web 应用程序项目的 ...\bin\Debug 中的 PerformanceTest.dll
  • 类库项目的...\obj\Debug 中的 SomeLibrary.dll

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

但是如果相反,我再次删除“SomeLibrary.dll”目标,请选择“添加目标二进制文件...”并手动选择 Web 应用程序的...\bin\调试...然后开始分析:报告看起来大致相同,但我可以浏览“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.

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

关于c# - Visual Studio 性能分析 - 找不到类库符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17993488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com