[英]Missing source code using MSTest with ANTS Performance Profiler
We're working on a project for a customer that uses ASP.NET C# with EF 6 and .Net Framework 4.6.1.我们正在为使用 ASP.NET C# 和 EF 6 和 .Net Framework 4.6.1 的客户开发一个项目。 We have some Integration Tests and Unit Tests which are running a bit slow, so we decided to run a profiler.
我们有一些运行速度有点慢的集成测试和单元测试,所以我们决定运行一个分析器。 In our searches, we came across ANTS Performance Profiler and decided to give it a go.
在我们的搜索中,我们遇到了 ANTS Performance Profiler 并决定试一试。
We created a profiling session with a .NET executable and configured the profiling mode as line-level & method-level timings - All methods inc. framework
我们使用 .NET 可执行文件创建了一个分析会话,并将分析模式配置为
line-level & method-level timings - All methods inc. framework
line-level & method-level timings - All methods inc. framework
. line-level & method-level timings - All methods inc. framework
。 However, when running the profiler we don't see any of our methods and are faced with the error message但是,在运行分析器时,我们看不到任何方法并面临错误消息
The profiler did not find any methods with the source code.
探查器没有找到任何带有源代码的方法。 To see all profiled methods, in Display Options below select 'All methods.
要查看所有分析的方法,请在下面的显示选项中选择“所有方法”。
How can I solve this?我该如何解决这个问题?
We initially experienced this problem using VSTest and then decided to change to MSTest, since it seems to have a better documentation ( 1 ).我们最初使用 VSTest 遇到了这个问题,然后决定改用 MSTest,因为它似乎有更好的文档 ( 1 )。 It also didn't work.
它也没有奏效。
We did some investigation and tried a few links ( 2 ) ( 3 ), but none of them helped.我们做了一些调查并尝试了一些链接 ( 2 ) ( 3 ),但没有一个有帮助。 We found out that a possible problem was ANTS Profiler not locating the
.pdb
file.我们发现一个可能的问题是 ANTS Profiler 没有找到
.pdb
文件。 However, we verified that the .pdb
file exists in the same folder and has the same name as the assembly's DLL.但是,我们验证了
.pdb
文件存在于同一文件夹中并且与程序集的 DLL 具有相同的名称。 We also ran Process Monitor and confirmed the process MSTest.exe
is reading the correct .pdb
file我们还运行了进程监视器并确认进程
MSTest.exe
正在读取正确的.pdb
文件
Here are the startup options:以下是启动选项:
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\MSTest.exe
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\MSTest.exe
/testcontainer:Projeto.dll /test:Projeto.Features._001_UsuarioFeature._001_A_1_1* /testsettings:"C:\\Users\\Documents\\projeto\\TestSettings1.testsettings"
/testcontainer:Projeto.dll /test:Projeto.Features._001_UsuarioFeature._001_A_1_1* /testsettings:"C:\\Users\\Documents\\projeto\\TestSettings1.testsettings"
: /testcontainer:Projeto.dll /test:Projeto.Features._001_UsuarioFeature._001_A_1_1* /testsettings:"C:\\Users\\Documents\\projeto\\TestSettings1.testsettings"
C:\\Users\\Documents\\projeto\\bin\\Debug
C:\\Users\\Documents\\projeto\\bin\\Debug
Additional info:附加信息:
We are running ANTS Performance Profiler version 10.1.5.1275我们正在运行 ANTS Performance Profiler 版本 10.1.5.1275
Operating System: Windows 10 Enterprise操作系统:Windows 10 企业版
We got in touch with RedGate Support and they solved our problem.我们联系了 RedGate 支持,他们解决了我们的问题。
Running the profiler with the /testcontainer
command line argument by itself worked!使用
/testcontainer
命令行参数运行探查器本身就起作用了! Turns out the /testsettings parameter was the one causing the malfunction and then, once I removed it, the profiler was able to see the source code.原来 /testsettings 参数是导致故障的参数,然后,一旦我删除了它,分析器就能够看到源代码。
Obs: The /testsettings
argument was required after we changed our testing tool to MSTest. Obs:在我们将测试工具更改为 MSTest 后,需要
/testsettings
参数。 It was responsible for referencing some of our dependencies.它负责引用我们的一些依赖项。 After removing the parameter, the solution was to hardcode the path of our dependencies, just for the sake of the test.
去掉参数后,解决方案是对我们的依赖项的路径进行硬编码,只是为了测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.