Visual Studio Performance Profiling-找不到类库符号

问题描述 投票:14回答:6

我正在尝试使用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.

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

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'的类库的任何内容,它在其中显示“ Loaded symbol for”。

有人知道为什么我无法检测类库吗?

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

c# visual-studio-2012 instrumentation class-library
6个回答
14
投票

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

现在,这可能只是我在讲话时应该闭嘴(因为我对Visual Studio探查器了解不足,而且我不知道为什么/如果要使用“ obj”二进制文件而不是“ bin”文件) “),因此,我想我最好描述一下我的思路:

VS在“ ASP.NET临时文件”位置中寻找符号文件(特别是.instr.pdb文件),因为这是从中加载类库dll的位置。不过,它找不到它,因为该文件是在类库项目的obj \ Debug中创建的,并且没有复制到Web应用程序的“ bin”文件夹中-因此,它永远不会将影子复制到“ ASP.NET临时文件”中也可以。

[从Performance Explorer中删除目标,然后选择“添加项目目标”,同时检查两个项目,可以准确地知道您(和我)以前拥有的内容:

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

因此,显然,这是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.

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


4
投票

我在VS2014中遇到这个问题,它的exe是为“任何CPU”构建的,并且设置了“首选32位”,而被引用的库没有“首选32位”(即32位exe,64位库)。

更改exe使其不“更喜欢32位”解决了符号问题,我认为这是因为修改了库以匹配exe的位数(在检测期间),并且符号不再匹配。


3
投票

此解决方案对我有用:

http://www.brothersincode.com/post/Matching-symbols-could-not-be-found-Performance-Profiler.aspx

您还可以尝试另一种方法,即按原样删除您的dll,并尝试将其从bin原因中删除,这可能也可以相反。


1
投票

我已经成功地管理了我的类库的配置文件-但仅在控制台应用程序中。在ASP.NET应用程序性能分析会话期间,我无法分析类库。

一些分类链接-las不解决我的问题,但可能会给您带来一些潜在优势:


0
投票

当前接受的答案帮助我到达了那儿,但是我会尽量向那些试图完成与我完全相同的事情的人谦虚地给出一些指导,以防万一我可以省下一些辛苦为某人谷歌搜索时间。我没有尝试对使用外部程序集的WCF服务进行概要分析,该程序集在运行时通过反射加载,并使该服务由我的自定义客户端触发。我有两个问题:我的WCF服务只是在性能分析会话期间根本没有启动(但是在调试时它总是会启动),然后由于某种原因而无法启动-Visual Studio无法为外部程序集加载符号。因此,要使这两项工作正常进行,我需要创建一个仪器性能会话,并将目标设置为我的主要WCF服务以及自定义的外部程序集,并设置启动模式-Internet Explorer(否则该服务将无法启动)。没有exe或从解决方案指向客户端。然后,我没有立即启动事件探查器,而是在“性能资源管理器”窗口中修改了它的属性,并将我的自定义客户端的二进制文件添加到了“启动”选项卡中,第二次启动(紧随服务本身之后)。它还有助于在客户端中具有正确的“服务引用”(我并没有真正使用它,我使用共享程序集并使用ChannelFactory生成通道)并首先以调试模式启动客户端(但实际上并未访问服务) )。也许这不是正确的方法,但是它可以解决问题,在经过2天的谷歌搜索后,我终于可以描述我的服务-关于该主题的文档不多,并且对此stackoverflow问题的公认答案是我的最佳资源找到。


0
投票

我正在使用Visual Studio 2019并在对ASP.NET网站进行性能分析时偶然发现了相同的问题。

© www.soinside.com 2019 - 2024. All rights reserved.