简体   繁体   中英

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 .

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.
  2. We do not run it directly, we open NUnit.exe through the start external program debug event. we load the .dll produced by the c# build and NUnit is able to run a series of tests. By running NUnit this way we have in the past been able to debug the routines in the unit test.
  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 ). Also i upgraded o The latest stable version of NUnit (2.6.4 .NET 3.5) and no change.
  4. We don't have a startup project - everything runs through 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. 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# .

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. 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 ...

This turned out to be a simple problem with NUnit rather than Visual studio. Essentially you need to add this to your NUnit configuration file before the <runtime\\> section:

  <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

Credit for this answer comes from here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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