VS 2010、NUIt 和“当前不会命中断点”。该文档尚未加载任何符号”

发布于 2024-09-06 03:30:15 字数 702 浏览 3 评论 0原文

使用 Windows 7 32 位、VS 2010、.NET 4 DLL、NUnit (2.5.5) 对应用程序进行单元测试。我目前收到以下错误;看到很多帖子并尝试了以下操作:

  1. 重新启动机器
  2. 重新启动 VS
  3. 删除 bin/obj 并重新加载
  4. clean/rebuild

但我无法让 NUnit 在运行时命中断点;

我将 NUNit 测试项目设置为指向 nunit.exe,并加载测试 .NET 4 DLL,但是当我运行它时找不到断点,“没有加载任何符号”。我尝试了“调试”>“Windows”>模块,当我运行它时它甚至不显示我的单元测试项目。

我发现这个,使用 nunit 代理: http://groups.google .com/group/nunit-discuss/browse_thread/thread/5680d7def5b6982f

但是当我使用 nunit 代理时也收到错误。我正在使用 nunit-agent-x86.exe,但我遇到了 system.formatexception 并且它崩溃了......

任何人都可以帮忙吗?

谢谢。

Using Windows 7 32 bit, VS 2010, .NET 4 DLL, NUnit (2.5.5) to unit test the application. I'm currently getting the following error; seen plenty of posts and tried the following:

  1. restart machine
  2. restart VS
  3. delete bin/obj and reload
  4. clean/rebuild

But I cannot get NUnit to hit my breakpoints when running;

I set the NUNit test project to point to the nunit.exe, and to load the testing .NET 4 DLL, but when I run it doesn't find the breakpoint, "no symbols have been loaded". I tried debug >windows > modules, it doesn't even show my unit testing project when I run it.

I found this, to use the nunit agent: http://groups.google.com/group/nunit-discuss/browse_thread/thread/5680d7def5b6982f

But I get an error when I use the nunit agent too. I was using nunit-agent-x86.exe, but I get a system.formatexception and it crashes...

Can anybody help?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

巷子口的你 2024-09-13 03:30:15

Stack Overflow 上还有另一个类似的问题这里 ,我发布了我的答案 对我有用的东西。我可以设置断点并直接从 Visual Studio 2010 中使用 Debug -> 启动 NUnit。启动新实例(我认为这是您的目标)。

我将 nunit.exe 设置为项目 -> 中的外部程序属性->调试并添加:

<startup>
    <requiredRuntime version="4.0.30319" />
</startup>

到 NUnit 安装目录中 nunit 可执行文件旁边的 nunit.exe.config 文件中。

There's another similar question here on Stack Overflow, where I posted my answer with what worked for me. I can set breakpoints and start NUnit directly from Visual Studio 2010 with Debug -> Start New Instance (which I think is your goal).

I set nunit.exe as the external program in project -> Properties -> Debugging and added:

<startup>
    <requiredRuntime version="4.0.30319" />
</startup>

to the nunit.exe.config file found next to the nunit executable in the NUnit install directory.

能怎样 2024-09-13 03:30:15

解决方案是:独立启动 NUnit,然后在 VS 2010 中进行 debug > >附加到进程,并附加到 nunit-agent.exe 进程,而不是 nunit 进程。 Nunit 进程仍然没有为我做这件事。

The resolution was: start NUnit stand alone, then in VS 2010, do debug > attach to process, and attach to the nunit-agent.exe process, not the nunit process. Nunit process still didn't do it for me.

温折酒 2024-09-13 03:30:15

对于网站项目,我收到“断点不会被击中...没有加载符号...”。发现我的网站存在构建错误(引用的 dll 之一由于某种原因丢失)。直到我在重建之前在 VS2010 中选择 View=>Error list 后,重建才显示问题。替换 bin 目录中丢失的 dll更新参考解决了我的问题。

I was getting "break point will not be hit ... no symbols loaded ..." for a website project. Found that there were build errors in my website (one of the referenced dll's went missing for some reason). Rebuilds didn't show the problem until I selected View=>Error list in VS2010, prior to the rebuild. Replacing the missing dll in the bin dir & updating the reference solved my problem.

朱染 2024-09-13 03:30:15

在 nunit-x86.exe.config 中添加以下部分对我有用:

  <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>

仅在使用 .NET 4 的客户端配置文件运行时才需要“sku”部分。请注意,之前的答案显示使用“requiredRuntime”,但它已过时。

Adding the following section in the nunit-x86.exe.config worked for me:

  <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>

The 'sku' section is only needed when running with .NET 4's Client Profile. Note that a previous answer showed using 'requiredRuntime' which is obsolete.

雨轻弹 2024-09-13 03:30:15

如果上述所有方法都没有帮助,请在 Visual Studio 中打开 NUnit 项目的属性,打开“构建”选项卡,单击“高级”按钮并确保“调试信息”设置为“完整”

If all of the above did not help, open the Properties of your NUnit project in Visual Studio, open "Build" tab, click the "Advanced" button and make sure "Debug Info" is set to "full"

酒与心事 2024-09-13 03:30:15

您是否正在运行 NUnit 然后加载 DLL?
尝试打开项目属性、“调试”选项卡,将启动操作切换为“启动外部程序”,指向 NUnit exe,将 dll 名称放入“命令行参数”中。
然后启动库项目,右键单击它并选择“调试”->“调试”。启动新实例。

Are you running NUnit and then loading the DLL?
Try instead opening the project properties, Debug tab, switch the start action to 'Start external program', point to the NUnit exe, put your dll name in 'command line arguments'.
Then start the library project right-clicking it and choosing Debug -> start new instance.

北凤男飞 2024-09-13 03:30:15

附加nunit-agent.exe进程而不是nunit.exe,因为当dotnet版本与nunit本身使用的版本不同时,nunit由nunit代理执行任务。请参阅下面的链接。

http://www.nunit.org/index.php ?p=nunit-agent&r=2.5.10

Attach nunit-agent.exe process instead of nunit.exe because when dotnet version is different form what is used by nunit it self, nunit execute the task by nunit agent. See the link below.

http://www.nunit.org/index.php?p=nunit-agent&r=2.5.10

小耗子 2024-09-13 03:30:15

我在 Visual Studio 2012 Community Edition 下使用 .NET Framework 4.5 时出现了这个问题。 nunit.exe.config 应该像这样(来自最受赞赏的答案的解决方案):

<configuration>
    <!--
   The GUI only runs under .NET 2.0 or higher. The
   useLegacyV2RuntimeActivationPolicy setting only
   applies under .NET 4.0 and permits use of mixed 
   mode assemblies, which would otherwise not load 
   correctly.
  -->
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <!-- Comment out the next line to force use of .NET 4.0 -->
         <requiredRuntime version="4.0.30319" />
    </startup>

This problem occurred to me under Visual Studio 2012 Community Edition, when working with .NET Framework 4.5. nunit.exe.config should like this (solution from the most appreciated answer):

<configuration>
    <!--
   The GUI only runs under .NET 2.0 or higher. The
   useLegacyV2RuntimeActivationPolicy setting only
   applies under .NET 4.0 and permits use of mixed 
   mode assemblies, which would otherwise not load 
   correctly.
  -->
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <!-- Comment out the next line to force use of .NET 4.0 -->
         <requiredRuntime version="4.0.30319" />
    </startup>
七堇年 2024-09-13 03:30:15

我需要打开 NUnit GUI

工具->设置->IDE 支持[单击 Visual Studio]

然后在 nunit-x86.exe.config (不是 nunit-exe.config,不是 nunit.agent .exe.config,而不是 nunit-console.exe.config)

我需要

   <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0.30319" />
  </startup>

I needed to open the NUnit GUI

Tools->Settings->IDE Support [click Visual Studio]

Then in the nunit-x86.exe.config (NOT nunit-exe.config, NOT nunit.agent.exe.config, NOT nunit-console.exe.config),

I needed

   <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0.30319" />
  </startup>

under <configuration>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文