簡體   English   中英

VS 2010,NUNit和“斷點目前不會被擊中。 沒有為此文檔加載任何符號“

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

使用Windows 7 32位,VS 2010,.NET 4 DLL,NUnit(2.5.5)對應用程序進行單元測試。 我目前收到以下錯誤; 看到很多帖子並嘗試了以下內容:

  1. 重啟機器
  2. 重啟VS.
  3. 刪除bin / obj並重新加載
  4. 清潔/重建

但是我跑步時無法讓NUnit達到我的斷點。

我將NUNit測試項目設置為指向nunit.exe,並加載測試.NET 4 DLL,但是當我運行它時沒有找到斷點,“沒有加載符號”。 我嘗試了debug> windows> modules,當我運行它時,它甚至沒有顯示我的單元測試項目。

我找到了這個,使用nunit代理: http ://groups.google.com/group/nunit-discuss/browse_thread/thread/5680d7def5b6982f

但是當我使用nunit代理時,我也會收到錯誤。 我使用的是nunit-agent-x86.exe,但是我收到了一個system.formatexception,它崩潰了......

有人可以幫忙嗎?

謝謝。

Stack Overflow上還有另一個類似的問題,我在那里發布了對我有用的答案 我可以使用Debug - > Start New Instance(我認為這是你的目標)直接從Visual Studio 2010設置斷點並啟動NUnit。

我將nunit.exe設置為項目中的外部程序 - >屬性 - >調試並添加:

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

到NUnit安裝目錄中nunit可執行文件旁邊的nunit.exe.config文件。

決議是:單獨啟動NUnit,然后在VS 2010中,執行debug> attach to process,並附加到nunit-agent.exe進程,而不是nunit進程。 Nunit進程仍然沒有為我做。

如果上述所有操作都沒有幫助,請在Visual Studio中打開NUnit項目的屬性,打開“Build”選項卡,單擊“Advanced”按鈕並確保“Debug Info”設置為“full”

對於一個網站項目,我得到“斷點不會被擊中......沒有符號加載......”。 發現我的網站中存在構建錯誤(其中一個引用的dll由於某種原因而丟失)。 在重建之前,我在VS2010中選擇了View => Error list之前,重建沒有顯示問題。 替換bin目錄中缺少的dll並更新引用解決了我的問題。

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

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

只有在運行.NET 4的客戶端配置文件時才需要'sku'部分。 請注意,之前的答案顯示使用的'requiredRuntime'已過時。

附加nunit-agent.exe進程而不是nunit.exe,因為當dotnet版本與nunit it self使用的不同時,nunit會執行nunit代理的任務。 請參閱以下鏈接。

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

你在運行NUnit然后加載DLL嗎? 嘗試打開項目屬性,調試選項卡,將啟動操作切換到'啟動外部程序',指向NUnit exe,將您的dll名稱放在'命令行參數'中。 然后啟動庫項目右鍵單擊它並選擇Debug - > start new instance。

使用.NET Framework 4.5時,在Visual Studio 2012 Community Edition下發生此問題。 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>

我需要打開NUnit GUI

工具 - >設置 - > IDE支持[單擊Visual Studio]

然后在nunit-x86.exe.config (NOT nunit-exe.config,NOT nunit.agent.exe.config,NOT nunit-console.exe.config)中

我需要

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

<configuration>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM