VS 2010, NUNit, and “The breakpoint will not currently be hit. No symbols have been loaded for this document”

后端 未结 9 1122
盖世英雄少女心
盖世英雄少女心 2021-02-05 02:38

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 followin

相关标签:
9条回答
  • 2021-02-05 02:50

    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.

    0 讨论(0)
  • 2021-02-05 02:51

    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.

    0 讨论(0)
  • 2021-02-05 02:54

    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>

    0 讨论(0)
  • 2021-02-05 03:08

    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>
    
    0 讨论(0)
  • 2021-02-05 03:11

    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

    0 讨论(0)
  • 2021-02-05 03:13

    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"

    0 讨论(0)
提交回复
热议问题