简体   繁体   English

除了.NET 3.5之外,不能在c#项目中命中断点

[英]Breakpoint cannot be hit in c# project for anything other than .NET 3.5

I have just upgraded a solution previously running in VS2008 on .NET 3.5 to VS2015 running on .NET 4.6 . 我刚刚将以前在.NET 3.5上的VS2008中运行的解决方案升级到在.NET 4.6上运行的VS2015。

Some information about the project 有关该项目的一些信息

  1. The solution only has one project and it is a Unit Test Project and simply creates 'AVTest.dll` which we load into NUnit to perform some functional tests on some hardware. 该解决方案只有一个项目,它是一个Unit Test Project ,只是创建'AVTest.dll`,我们加载到NUnit中 ,在某些硬件上执行一些功能测试。
  2. We do not run it directly, we open NUnit.exe through the start external program debug event. 我们不直接运行它,我们通过启动外部程序调试事件打开NUnit.exe。 we load the .dll produced by the c# build and NUnit is able to run a series of tests. 我们加载由c#build生成的.dll,NUnit能够运行一系列测试。 By running NUnit this way we have in the past been able to debug the routines in the unit test. 通过以这种方式运行NUnit,我们过去能够在单元测试中调试例程。
  3. NUnit version is 2.5.10 which uses .NET 2.0 (given that we were running and breaking with .NET 3.5 seems like this probably isnt it ). NUnit版本是2.5.10,它使用.NET 2.0(鉴于我们运行并打破.NET 3.5似乎这可能不是这样 )。 Also i upgraded o The latest stable version of NUnit (2.6.4 .NET 3.5) and no change. 我也升级了o最新稳定版的NUnit(2.6.4 .NET 3.5),没有任何变化。
  4. We don't have a startup project - everything runs through NUnit. 我们没有启动项目 - 一切都通过NUnit运行。

Everything builds and runs correctly however i get the following error when trying to set breakpoints: 所有东西都构建并正确运行但是在尝试设置断点时出现以下错误:

The breakpoint will not currently be hit. 断点当前不会被击中。 No symbols have been loaded for this document. 没有为此文档加载任何符号。

When i switch back to .NET 3.5 i am able to set breakpoints in the code. 当我切换回.NET 3.5时,我能够在代码中设置断点。 The fact that i can do this makes me think i am missing somerthing simple about the .NET version since i am not so familiar with c# . 我可以这样做的事实让我觉得我缺少关于.NET版本的简单,因为我对c#不太熟悉。

I am aware of this question and have tried all of the things from the question itself and the first page of answers. 我知道这个问题,并尝试了问题本身和答案第一页的所有内容。

Has there been any developments on how to check why there have been no loaded symbols? 关于如何检查没有加载符号的原因是否有任何进展?

A New Development 一个新的发展

I am able to debug just fine when i attach to the Nunit test that is already running. 当我附加到已经运行的Nunit测试时,我能够正常调试。 I am not sure why it isnt attached after running (through start external program) or why this works in 3.5 and not 4.6, but it can be debugged ... 我不确定它为什么在运行后(通过启动外部程序)或者为什么在3.5而不是4.6中工作,但它可以被调试...

This turned out to be a simple problem with NUnit rather than Visual studio. 这对NUnit而不是Visual studio来说是一个简单的问题。 Essentially you need to add this to your NUnit configuration file before the <runtime\\> section: 基本上,您需要在<runtime\\>部分之前将其添加到NUnit配置文件中:

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

This file is usually located here: 此文件通常位于此处:

C:\\Program Files (x86)\\NUnit 2.5.10\\bin\\net-2.0\\nunit-x86.exe.config C:\\ Program Files(x86)\\ NUnit 2.5.10 \\ bin \\ net-2.0 \\ nunit-x86.exe.config

Credit for this answer comes from here . 这个答案来自于此

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM