简体   繁体   English

如何补救“当前不会命中断点。没有为该文档加载任何符号。” 警告?

[英]How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

A C# desktop application (on the Visual Studio Express edition) worked, but then it didn't work 5 seconds later.一个 C# 桌面应用程序(在 Visual Studio Express 版本上)可以运行,但 5 秒后它就不能运行了。

I tried the following:我尝试了以下内容:

  • Ensure debug configuration, debug flag, and full debug information are set on all assemblies.确保在所有程序集中设置调试配置、调试标志和完整的调试信息。
  • Delete all bin and obj folders and all DLL files related to the project from my entire machine.从我的整台机器上删除所有与项目相关的bin和obj文件夹以及所有DLL个文件。
  • Recreate projects causing the problem from scratch.从头开始重新创建导致问题的项目。
  • Reboot.重启。

I have two Windows Forms projects in the solution.我在解决方案中有两个 Windows Forms 项目。 One of them loads the debug information, one doesn't.其中一个加载调试信息,一个不加载。 They both refer to the assembly I'm trying to get debug information on in exactly the same way in the project file.它们都引用了我试图在项目文件中以完全相同的方式获取调试信息的程序集。 Any ideas?有任何想法吗?


I want to add here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed.我想在这里补充一点,主要是为了我自己,当我回来复习这个问题时,直到加载程序集才加载符号,直到需要时才加载程序集。 If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.如果断点位于仅在主程序集中的一个 function 中使用的库中,则在调用 function 之前不会加载符号(并且它将显示断点未命中)。

Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All , use Debug > Windows > Modules .到达断点或使用Debug > Break All后立即开始调试,使用Debug > Windows > Modules You'll see a list of all the assemblies that are loaded into the process.您将看到加载到进程中的所有程序集的列表。 Locate the one you want to get debug info for.找到您要为其获取调试信息的那个。 Right-click it and select Symbol Load Information.右键单击它并选择符号加载信息。 You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly.您将看到一个对话框,其中列出了它为程序集查找 .pdb 文件的所有目录。 Verify that list against the actual .pdb location.根据实际的 .pdb 位置验证该列表。 Make sure it doesn't find an old one.确保它没有找到旧的。

In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe, ie the bin\Debug folder of your project.在普通项目中,程序集及其 .pdb 文件应始终由 IDE 复制到与 .exe 相同的文件夹中,即项目的 bin\Debug 文件夹。 Make sure you remove one from the GAC if you've been playing with it.如果您一直在使用它,请确保从 GAC 中删除它。

Check if you are not in release but in Debug.检查您是否不在发布中,而是在调试中。

When in debug:调试时:

First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)首先尝试通过鼠标右键单击项目> Rebuild来重建您的项目如果这不起作用,请尝试清理项目(鼠标右键单击项目>清理)

If that didn't work check this:如果这不起作用,请检查:

  1. Right mouse click your project鼠标右键单击您的项目
  2. Select [Properties]选择[属性]
  3. Select the [Build] tab选择[构建]选项卡
  4. Make sure [Define DEBUG constant] and [Define TRACE constant] are checked确保选中[Define DEBUG constant][Define TRACE constant]
  5. Make sure [Optimize Code] is unchecked确保未选中[优化代码]
  6. Click the [Advanced] button at the bottom of the Build tabpage点击 Build 标签页底部的[Advanced]按钮
  7. Make sure that [Debug Info:] is set to [full]确保[Debug Info:]设置为[full]
  8. Click [OK] and rebuild the project ;-)单击[OK] 并重建项目;-)

(step 7 generates the .pdb files, these are the debugging symbols) (第 7 步生成 .pdb 文件,这些是调试符号)

Just something simple to try - you may have tried it already.只是一些简单的尝试 - 你可能已经尝试过了。 Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution .右键单击解决方案资源管理器中的解决方案,单击“清理解决方案”,这将删除与解决方案关联的所有已编译和临时文件

Do a rebuild of the solution and try to debug again.重新构建解决方案并尝试再次调试。

I've also had troubles with breakpoints multiple projects in a solution - some compiled as x86, some as x64.我也遇到了解决方案中多个项目的断点问题——一些编译为 x86,一些编译为 x64。

在调试/常规设置中禁用“仅我的代码”选项。

Cross posting this fix from Hans K that I found on the similar thread >> HERE << :我在类似线程上找到的Hans K交叉发布此修复>> HERE <<

Right click on solution --> Properties右键单击解决方案->属性

Look under Common Properties --> Startup Project查看 Common Properties --> Startup Project

Select multiple startup projects选择多个启动项目

select Start action on the projects you need to debug.对需要调试的项目选择开始操作。

The selected answer led me to fix my problem.选定的答案使我解决了我的问题。 But I need to do a few things more:但我还需要做一些事情:

Even with "Debug" selected in the dropdown:即使在下拉列表中选择了“调试”:

在此处输入图像描述

And in the project Properties > Build:在项目属性>构建中:

在此处输入图像描述

The Visual Studio was not loading symbols to a specific project. Visual Studio 未将符号加载到特定项目。 So in that dropdown I select "Configuration Manager" and saw that the settings to my web project was incorrect:因此,在该下拉列表中,我选择了“配置管理器”,发现我的 Web 项目的设置不正确:

在此处输入图像描述

在此处输入图像描述

Then I set that to "Debug" and it started to generate the .pdb file.然后我将其设置为“调试”并开始生成.pdb文件。 BUT I need to manually copy the PDB and DLL and put in the folder that VS was looking (here is where the selected answer helped me):但是我需要手动复制 PDB 和 DLL 并放入 VS 正在查找的文件夹中(这里是所选答案对我有帮助的地方):

在此处输入图像描述

Sometimes, even though it gives you this error, the Breakpoint still gets hit, so just ignore the error.有时,即使它给你这个错误, Breakpoint仍然会被命中,所以忽略这个错误。 This happens fairly often in the Views of an MVC web app , ie .cshtml .这在MVC web appViews中经常发生,即.cshtml

Debug > Windows > Modules to see what modules were being loaded put me in the right direction. Debug > Windows > Modules看看正在加载哪些模块,这让我朝着正确的方向前进。

In my case IIS Express seemed to be loading a different DLL from the temporary ASP.NET files.就我而言,IIS Express 似乎从临时 ASP.NET 文件加载了不同的 DLL。

The solution?解决方案?

  1. Browse to C:\Users\<YOUR USER>\AppData\Local\Temp\Temporary ASP.NET Files\vs浏览到C:\Users\<YOUR USER>\AppData\Local\Temp\Temporary ASP.NET Files\vs
  2. Delete everything in this directory!删除此目录中的所有内容!

I was able to fix the error by simply setting the option in the 'Attach to Process' to 'Automatically determine the type of code to debug' option as shown in the attached screenshot.我可以通过简单地将“附加到进程”中的选项设置为“自动确定要调试的代码类型”选项来修复错误,如随附的屏幕截图所示。

Simply follow the steps below:只需按照以下步骤操作:

  • Go to Debug from the menu bar从菜单栏中转到调试
  • Click on Attach to Process单击附加到进程
  • Near the Attach to option, click on the Select button附加到选项附近,单击选择按钮
  • The Select Code Type window will appear将出现选择代码类型窗口
  • Now select the option Automatically determine the type of code to debug and click the OK button.现在选择选项自动确定要调试的代码类型,然后单击确定按钮。

修复调试错误

Check if your .pbd file is missing in your bin/Debug folder.检查 bin/Debug 文件夹中是否缺少 .pbd 文件。 If it is then go to "Properties" of your project, selected "Build" and then "Advanced" at the bottom.如果是,则转到项目的“属性”,选择“构建”,然后在底部选择“高级”。 Choose "full" under "Debug info" in the new window that appeared.在出现的新窗口中选择“调试信息”下的“完整”。 This was my issue and solved it for me.这是我的问题并为我解决了。

显示在哪里可以找到设置

In my case "Optimize Code" was checked in my project properties.在我的情况下,在我的项目属性中检查了“优化代码”。 This caused VS to see my assembly as "not my code", and in turn, it did not load symbols for it.这导致 VS 将我的程序集视为“不是我的代码”,反过来,它没有为它加载符号。

The solution was to uncheck this.解决方案是取消选中此项。 优化代码复选框的位置

只需检查您的解决方案是否处于发布模式。

尝试在 Windows 中以管理员身份运行 Visual Studio。

In my case i am trying to debug in relase mode.就我而言,我正在尝试在发布模式下进行调试。 Once i change it to debug mode.一旦我将其更改为调试模式。 Its working它的工作

Debug -> Options -> General -> Uncheck mark for " Enable Just My Code "调试->选项->常规->取消选中“ Enable Just My Code ”标记

This worked for me.这对我有用。

您需要在编译器设置中启用“生成调试信息”

I tried everything mentioned above, but nothing worked.我尝试了上面提到的所有方法,但没有任何效果。 [Clean solution, and check for PDB files etc.] [清理解决方案,并检查 PDB 文件等]

Even publishing the same solution did not resolve the issue.即使发布相同的解决方案也无法解决问题。

Then I went to back to what I usually do to resolve (fool this stubborn Visual Studio)然后我又回到了我通常做的事情来解决(愚弄这个顽固的 Visual Studio)

All I did was to make a deliberate change in code and publish the solution.我所做的只是故意更改代码并发布解决方案。 Then I reverted the change and published again.然后我恢复了更改并再次发布。

Voila [PDB files rid of evil spirits].. Not a smart resolution, but this did work.. :-|瞧 [PDB 文件摆脱邪灵].. 不是一个聪明的解决方案,但这确实有效.. :-|

Check your Solution Configuration drop down list.检查您的Solution Configuration下拉列表。 Make sure you select Debug , not Release .确保您选择Debug ,而不是Release

Option "Start debugging, Debug + Windows + Modules" does not exist in Microsoft Visual Studio Express 2013 edition. Microsoft Visual Studio Express 2013 版中不存在“开始调试,调试 + Windows + 模块”选项。

Unchecking "Use Managed Compatibility Mode" in Tools Options Debugging fixes this.在工具选项调试中取消选中“使用托管兼容模式”可以解决此问题。

We found the cause of our problem.我们找到了问题的原因。 This code was using the "CodeBehind" attribute in the Page directive of the .aspx file instead of the "CodeFile" attribute (ASP.NET 2.0 and beyond).此代码使用 .aspx 文件的 Page 指令中的“CodeBehind”属性,而不是“CodeFile”属性(ASP.NET 2.0 及更高版本)。 After days of desperation, a simple search and replace solved the problem.经过几天的绝望,一个简单的搜索和替换解决了这个问题。

Webapplications (IIS Express) only:仅限 Web 应用程序 (IIS Express):

  • Rightclick IIS Express Tray and close the IIS.右键单击 IIS Express 托盘并关闭 IIS。
  • Clean Solution清洁解决方案

IIS 托盘

  1. Clean solution and Rebuild清洁解决方案并重建
  2. Check the configuration is set to Debug检查配置是否设置为调试
  3. Make sure that the PDB file is in the Debug folder it self确保 PDB 文件位于它自己的 Debug 文件夹中
  4. From Debug menu click Enable All Break points从调试菜单中单击启用所有断点

None of those answers solved my problem.这些答案都没有解决我的问题。 I tried another thing based on fact that the project with the stop wasn't in reality the loaded project.基于停止的项目实际上不是加载的项目,我尝试了另一件事。 I found as Hans Passant wrote that the .dll where I want to stop debugger and the associoated .pdb files where copied near the .exe file.我发现 Hans Passant 写道,我想停止调试器的 .dll 和在 .exe 文件附近复制的相关 .pdb 文件。 Those files have had an older date so I thought they wasn't updated in the runtime.这些文件的日期较旧,所以我认为它们没有在运行时更新。 I manually deleted them, Visual Studio create another pair AND put this new pair near the .exe.我手动删除了它们,Visual Studio 创建了另一对并将这对新的一对放在 .exe 附近。 Now the breakpoins works !现在断点起作用了!

Maybe Visual Studio cannot copy and REPLACE existing files (.dll and .pdb) near the .exe since there are another there.也许 Visual Studio 无法复制和替换 .exe 附近的现有文件(.dll 和 .pdb),因为那里还有另一个文件。 So if I deleted manually then VS could create new one near .exe.因此,如果我手动删除,那么 VS 可以在 .exe 附近创建新的。

I think that another changes (checks and so on - from the another answers) triggered something and Visual Studio copied and replaced the dll and pdb from the project folder to the folder near the exe, so that was a solution.我认为另一个更改(检查等 - 从另一个答案)触发了一些东西,Visual Studio 将项目文件夹中的 dll 和 pdb 复制并替换到了 exe 附近的文件夹,所以这是一个解决方案。

I think that the root cause of the problem is that the Visual Studio use another file in runtime, no the file from the project, with the stop.我认为问题的根本原因是Visual Studio在运行时使用了另一个文件,没有来自项目的文件,并且停止了。

Maybe this answer to help someone !也许这个答案可以帮助某人!

Check are the following two setting the same in Visual Studio:检查以下两个设置是否在 Visual Studio 中相同:

Right click test project, go to Properties, Build tab, and look at Platform target右键单击测试项目,转到属性,构建选项卡,然后查看平台目标

Mine are all set to "Any CPU" so x64我的都设置为“任何 CPU”,所以x64

在此处输入图像描述

On the Main Menu bar, go to Test, Test Settings, Default Processor Architecture在主菜单栏上,转到测试、测试设置、默认处理器架构

Mine was set to X86我的设置为X86

在此处输入图像描述

Changing this to X64 to match above setting made the built in Visual Studio menu “Debug Test(s)” work and hit breakpoints that were previously ignored with the message “The breakpoint will not currently be hit.将其更改为X64以匹配上述设置使内置的 Visual Studio 菜单“调试测试”工作并命中先前被忽略的断点,并显示消息“当前不会命中断点。 No symbols have been loaded for this document”.没有为此文档加载任何符号”。

Update:更新:

For Visual Studio 2019 the menus have been moved around a bit:对于Visual Studio 2019 ,菜单进行了一些移动: 在此处输入图像描述

Instead of doing all these things just而不是只做所有这些事情

Close and reopen关闭并重新打开

the solution it will fix the issue它将解决问题的解决方案

我有类似的问题,我做了以下事情:调试=>选项=>常规=>删除“启用我的代码”的复选标记这对我有用..

I also had the same issue what I rebuild the whole solution (including refereced projects) in x86( or x64)我也有同样的问题,我在 x86(或 x64)中重建整个解决方案(包括引用的项目)

Even though I set all of my projects to x86 from Configuration Manager (Build->ConfigManager) some of my projects were not set to x86.即使我从配置管理器(Build->ConfigManager)将我的所有项目都设置为 x86,但我的一些项目并未设置为 x86。

So Just to make sure right click on the project and follow所以只是为了确保右键单击该项目并按照

project -> properties -> Debug Tab, verify Configuration and Platform.项目 -> 属性 -> 调试选项卡,验证配置和平台。

Things to check just to be clear: Make sure you have the configuration set to 'Debug' and not 'Release'.需要检查的事情要清楚:确保您将配置设置为“调试”而不是“发布”。 You can debug the startup project in 'Release' mode, but not a referenced class library.您可以在“发布”模式下调试启动项目,但不能调试引用的类库。

Project Properties (then select your build config) > Build Tab > Advanced... > Debug Info (dropdown)项目属性(然后选择您的构建配置)>构建选项卡>高级...>调试信息(下拉)

Set to 'all' or 'pdb-only' then rebuild设置为 'all' 或 'pdb-only' 然后重建

This took me a while tried other options above and for some strange reason debugging stopped working.这花了我一段时间尝试了上面的其他选项,并且由于某种奇怪的原因调试停止工作。

Tool -> Options -> Debugging -> General -> (untick) "Require source files to exactly match the original version" option工具 -> 选项 -> 调试 -> 常规 -> (取消勾选)“要求源文件与原始版本完全匹配”选项

我知道我迟到了几年,但我认为我做错了什么并按照上述步骤操作然后我意识到我错误地将解决方案配置设置为“发布”:)

I have read carefully all the answers above, but none of them solved my problem.我已经仔细阅读了上面所有的答案,但没有一个能解决我的问题。

In my case, I was compiling a class library (DLL).就我而言,我正在编译一个类库 (DLL)。 No modules seem to be loaded in Debug -> Modules, so I couldn't even load the symbols manually. Debug -> Modules 中似乎没有加载任何模块,所以我什至无法手动加载符号。

My solution was to add this line to my code:我的解决方案是将此行添加到我的代码中:

System.Diagnostics.Debugger.Launch();

Once this code is reached, an exception is triggered and .NET Framework shows a dialog box asking which Visual Studio (ie new instance of VS 2008, new instance of VS 2013, etc) you want to use to debug the program.到达此代码后,将触发异常,并且 .NET Framework 会显示一个对话框,询问您要使用哪个 Visual Studio(即 VS 2008 的新实例、VS 2013 的新实例等)来调试程序。 You can choose the existing instance of VS with your project loaded.您可以在加载项目的情况下选择现有的 VS 实例。 This will attach the process to your VS session and load all symbols, and now you can debug your project.这会将进程附加到您的 VS 会话并加载所有符号,现在您可以调试您的项目。

Of course, the compilation has to be done using the Debug configuration, not Release.当然,编译必须使用 Debug 配置完成,而不是 Release。

  1. Make sure you're in Debug and not is release by choosing debug in the dropdown menu like you can see in the picture below.通过在下拉菜单中选择debug ,确保您处于Debug状态而不是release状态,如下图所示。

在此处输入图像描述

  1. Then, try cleaning your project by clicking the right button in your mouse on the solution in the solution explorer window and choosing Clean solution .然后,尝试通过在解决方案资源管理器窗口中的解决方案上单击鼠标右键并选择Clean solution来清理您的项目。

在此处输入图像描述

  1. Then rebuild your solution by clicking the right button in your mouse on the solution in the solution explorer window and choose Rebuild solution然后通过在解决方案资源管理器窗口中的解决方案上单击鼠标右键并选择Rebuild solution来重建您的解决方案

在此处输入图像描述

Right click on Project -> Properties -> Go to Build Tab -> Uncheck Optimize Code .右键单击 Project -> Properties -> Go to Build Tab -> 取消选中Optimize Code Do It for any project in your solution为您解决方案中的任何项目执行此操作

After trying a bunch of these, the thing that ultimately worked for me was this:在尝试了一堆这些之后,最终对我有用的是:

In Debug > Options > General , uncheck Enable Edit and Continue .Debug > Options > General中,取消选中Enable Edit and Continue

I have been fighting this problem for almost an hour.我已经与这个问题作斗争了将近一个小时。 Then I figured out that I stupidly mistakenly linked a "release" static library instead of the "debug" version of that library.然后我发现我愚蠢地错误地链接了一个“发布”静态库而不是那个库的“调试”版本。 My setup is VS2019 with "CMake" project and I am doing a C++/VulkanAPI project.我的设置是带有“CMake”项目的 VS2019,我正在做一个 C++/VulkanAPI 项目。 The setup might be quite different for your project, yet the issue might still occur.您的项目的设置可能完全不同,但问题可能仍然存在。

I know there are almost ~30 answers already, yet I just wanted to share my experience here, so "Maybe" someone may forget to change the release libs into the debug libs.我知道已经有将近 30 个答案,但我只是想在这里分享我的经验,所以“也许”有人可能会忘记将发布库更改为调试库。

I was integrating a C# application with a static library using VS10 - which I'm new to.我正在使用 VS10 将 C# 应用程序与静态库集成 - 我是新手。 I wrote a managed code dll to interface them.我编写了一个托管代码 dll 来接口它们。 I could set breakpoints everywhere but the static lib.除了静态库,我可以在任何地方设置断点。 I got the message described above - no symbols have been loaded for this document.我收到了上述消息 - 没有为此文档加载任何符号。 I tried many of the suggestions above.我尝试了上面的许多建议。 I could see that the symbols weren't being loaded.我可以看到符号没有被加载。 I finally noticed a check box Configuration Debug, Enable unmanaged code debugging.我终于注意到一个复选框配置调试,启用非托管代码调试。 That allowed me to set breakpoints in the static lib functions.这让我可以在静态库函数中设置断点。

For an ASP.Net application, check the properties of the site, ASP.NET tab.对于 ASP.Net 应用程序,检查站点的属性,ASP.NET 选项卡。 Ensure that the correct ASP.NET version is selected.确保选择了正确的 ASP.NET 版本。

this happened to me after copy paste another webservice asmx file into an existing webservice, resulting in the same error when trying to debug the recently added service, to be able to debug I had to start without debug, then attach to the process.这发生在我将另一个 webservice asmx 文件复制粘贴到现有 webservice 后,在尝试调试最近添加的服务时导致相同的错误,为了能够调试,我必须在不调试的情况下启动,然后附加到进程。 its weird but its the only way i found to be able to debug.它很奇怪,但它是我发现能够调试的唯一方法。

If we get the latest from VSTS, all files will be in read only mode.如果我们从 VSTS 获取最新版本,所有文件都将处于只读模式。 While running project all class library classes get read only and brakepoints turn empty and say "Breakpoint will not currently be hit. No symbols loaded for this document".在运行项目时,所有类库类都是只读的,并且断点变为空并说“断点当前不会被击中。没有为此文档加载符号”。

Solution 1解决方案 1

Go to the project location and right lick the folder ---> Properties ---> General Tab ---> UNCHECK read-only (Only applies to files in the folder) ---> Apply ---> Ok转到项目位置并右键单击文件夹--->属性--->常规选项卡--->取消选中只读(仅适用于文件夹中的文件)--->应用--->确定

Solution 2解决方案 2

Start debugging, Go to Debug ---> Windows ---> Modules.Select one assembly and Right-click ---> (Select) Symbol Setting.开始调试,转到调试---> Windows ---> 模块。选择一个程序集并右键单击--->(选择)符号设置。 Set Your Bin path in Cache symbol in this directory and select Microsoft Servers in Symbol of PDB location.在此目录中的缓存符号中设置您的 Bin 路径,然后在 PDB 位置的符号中选择 Microsoft 服务器。 Click Load All Symbols.单击加载所有符号。 It will take time.Then click OK.这需要一些时间。然后单击“确定”。

Now the symbol status of all assembly has been changed from "can not find or open PDB" to "Symbols loaded".现在所有程序集的符号状态已从“找不到或无法打开 PDB”更改为“已加载符号”。

I tried all of these and could not get my break-point working...我尝试了所有这些,但无法让我的断点工作......

What i did to fix this issue was我为解决这个问题所做的是

In the page where my break-point was not hitting, i selected the folder > add an existing item and then select the page from its save path.在我的断点未命中的页面中,我选择了文件夹>添加现有项目,然后从其保存路径中选择页面。 This allowed the break point to start working.这允许断点开始工作。

[ WINCE ] I happened to encounter this during build on WinCE, it seemed that the 'Clean' did not clean the target folder on the device, I got the debug/break back by changing the Output folder on Devices (Project Properties-->Devices tab-->change Output folder to other than the previous failed debug) -- and voila!! [ WINCE ] 我在 WinCE 上构建期间碰巧遇到了这个问题,似乎“清理”没有清理设备上的目标文件夹,我通过更改设备上的输出文件夹(项目属性->设备选项卡->将输出文件夹更改为先前失败的调试以外的文件夹)-瞧! it works.有用。 Might have to do manual cleanup on the device, but that will be later.可能需要在设备上进行手动清理,但这将在以后进行。

Hope this help.希望这有帮助。

If you are finding that you are having to build projects in your solution individually in a particular order to get the solution to build because building the solution directly after a clean doesn't work, and then you are finding the problem described in the Question, it is possibly due to the inclusion of some additional projects that have references to incorrect relative paths because they have been added to your solution from a different location.如果您发现必须以特定顺序在解决方案中单独构建项目才能构建解决方案,因为在清理后直接构建解决方案不起作用,然后您会发现问题中描述的问题,这可能是由于包含了一些额外的项目,这些项目引用了不正确的相对路径,因为它们已从不同的位置添加到您的解决方案中。 Therefore, the relative paths don't go to the same location as the .csproj files that are sat in folders directly under your .sln file.因此,相对路径与位于 .sln 文件下的文件夹中的 .csproj 文件的位置不同。

The reason it would build by building the projects one by one in a particular order is because the other projects reference the same libraries but then build to the GAC.它会以特定顺序逐个构建项目的原因是因为其他项目引用相同的库,然后构建到 GAC。 The solution ends up building but the symbols it loads are from the GAC and these symbols may become outdated.解决方案最终构建,但它加载的符号来自 GAC,这些符号可能会过时。

The solution as it were is to restructure the physical folder structure of your solution and projects, or to open the .csproj files individually and fix the relative paths so that all references to any given library ultimately point to the same location in all projects.解决方案是重新构建解决方案和项目的物理文件夹结构,或者单独打开 .csproj 文件并修复相对路径,以便对任何给定库的所有引用最终指向所有项目中的相同位置。 Or perhaps use the $(SolutionDir) token.或者也许使用$(SolutionDir)令牌。

And if all else still fails, then you need to force Visual Studio into resetting your build configuration and this requires you to uncheck all projects for all build configurations and then to recheck them all - see the solution here .如果所有其他方法仍然失败,那么您需要强制 Visual Studio 重置您的构建配置,这需要您取消选中所有项目的所有构建配置,然后重新检查它们 - 请参阅此处的解决方案。

For me, the problem was just that I was trying to debug in a web project that was not set as the startup project.对我来说,问题只是我试图在一个未设置为启动项目的 Web 项目中进行调试。 So it was not well compiled when running debug and the .pdb wasn't up to date.所以在运行调试时编译得不好,.pdb 不是最新的。

Just setting the project to "Set up as startup project" did the trick.只需将项目设置为“设置为启动项目”就可以了。

Hope this helps希望这可以帮助

I had the same issue and I tried everything possible...some of those are我有同样的问题,我尝试了一切可能的......其中一些是

1) Nuking temp files in Temporary ASP.NET Folders in bin and obj folders. 1) 在 bin 和 obj 文件夹中的临时 ASP.NET 文件夹中对临时文件进行核对。

2) Unchecking the Optimize code and Enable my code 2)取消选中优化代码并启用我的代码

3) Navigating and trying to manually load the symbols from module windows. 3) 导航并尝试从模块窗口手动加载符号。

4) Checking the build flag in the properties of solution. 4) 检查解决方案属性中的构建标志。 ........ ...........

And the list goes on.. I spent like one day on this but what finally worked for me actually was... I knew that the symbols for my project was not being loaded and i could not see any modules with my project name in the modules window either...清单还在继续……我花了一天的时间,但最终对我有用的是……我知道我的项目的符号没有被加载,我看不到任何带有我的项目名称的模块模块窗口...

so the issue was my symbols were being brought from virtual directory path of the project... and it was mapped to the virtual directory of some other project instead... the web project that was supposed to load in the modules was not there Following are the steps i followed..所以问题是我的符号是从项目的虚拟目录路径中带来的......并且它被映射到其他项目的虚拟目录......应该在模块中加载的Web项目不存在以下是我遵循的步骤..

  • Right click the specific web project and select properties右键单击特定的 Web 项目并选择属性
  • Go to Web tab转到 Web 选项卡
  • You can see the Create Virtual Directory button您可以看到创建虚拟目录按钮
  • As soon as i clicked it i saw an alert message saying "the (projectname) is mapped to (anotherProjectName)" are you sure you want to do the remapping?当我点击它时,我看到一条警告消息说“(项目名称)已映射到(另一个项目名称)”你确定要重新映射吗? Something like this像这样的东西
  • then it made sense that for why i was seeing the unecessary project name in the modules window那么为什么我在模块窗口中看到不必要的项目名称是有道理的
  • then i rebuilt the solution and was able to hit the breakpoint然后我重建了解决方案并能够达到断点

I was getting this and was stumped (using Visual Studio 2013 Premium).我得到了这个并且被难住了(使用 Visual Studio 2013 Premium)。

Normally our apps at work reference .dlls in a particular common/app directory, like this: C:\OurCompanyApps\xxxxxx.dll.通常,我们工作中的应用程序会引用特定 common/app 目录中的 .dll,例如:C:\OurCompanyApps\xxxxxx.dll。 This was happening in a solution that has a bunch of WinForm and .dll projects in it.这发生在一个包含一堆 WinForm 和 .dll 项目的解决方案中。 The .dll projects compile to C:\OurCompanyApps\ and the WinForm projects reference the compiled .dll files in that location. .dll 项目编译到 C:\OurCompanyApps\,WinForm 项目引用该位置中已编译的 .dll 文件。

The problem: I found that the app in question was referencing the .dll project in the Source Control bin\Debug location instead of the compiled .dll file in C:\OurCompanyApps.问题:我发现有问题的应用程序引用了源代码管理 bin\Debug 位置中的 .dll 项目,而不是 C:\OurCompanyApps 中的已编译 .dll 文件。

Solution: I deleted the reference and re-added it from the C:\OurCompanyApps\ location.解决方案:我删除了引用并从 C:\OurCompanyApps\ 位置重新添加了它。 Then I could step-through the breakpoints I had added in the .dll code.然后我可以单步执行我在 .dll 代码中添加的断点。

Hope this helps someone.希望这可以帮助某人。

If you have both C# and native code(C/C++), make sure that native debugging is enabled for the project:如果您同时拥有 C# 和本机代码 (C/C++),请确保为项目启用本机调试:
1. Right-click your Startup Project in Solution Explorer 1. 在解决方案资源管理器中右键单击您的启动项目
2. Select Properties 2.选择属性
3. Select "Debug" tab 3.选择“调试”选项卡
4. Make sure Native Code debugging is enabled 4.确保启用本机代码调试必须选中“启用本机代码调试”才能调试您的本机代码

Try to do this.尝试这样做。 It worked for me.它对我有用。

Debug=>Options=>General => Remove the check mark for "Enable Just My Code" Debug=>Options=>General => 去掉“Enable Just My Code”的复选标记

I think the source if this error is, the debug symbols have a hard time surfacing to the solution after building for release.我认为如果这个错误的来源是,调试符号在构建发布后很难出现在解决方案中。

I tried all the other answers -- generally, regenerating .pdb symbols or checking their location, cleaning and rebuilding project, ensuring active configuration is not Release etc.我尝试了所有其他答案——通常,重新生成 .pdb 符号或检查它们的位置,清理和重建项目,确保活动配置不是 Release 等。

What eventually worked for me is right-clicking on the project in solution explorer > Debug > Start new instance.最终对我有用的是右键单击解决方案资源管理器中的项目 > 调试 > 启动新实例。

The Following steps forked for me:以下步骤为我分叉:

  1. Go to the "bin" folder of your project.转到项目的“bin”文件夹。
  2. Delete the "Debug" folder.删除“调试”文件夹。
  3. Build your project again.再次构建您的项目。
  4. The Debug folder will get re-created. Debug 文件夹将被重新创建。

Now you can start debugging again.现在您可以再次开始调试。

I resolved this way: Run the project.我这样解决:运行项目。 Go to, Debug -> Windows -> Modules Choose the library you want debug and right click in it.转到,Debug -> Windows -> Modules 选择要调试的库并右键单击它。 Choose -> "Load Symbols" and then will change "Skipped loading suymbols" for "Symbols loaded".选择->“加载符号”,然后将“跳过加载符号”更改为“加载符号”。

I had same issue with Visual Studio 2019 community and Asp.net Web form project.我在 Visual Studio 2019 社区和 Asp.net Web 表单项目中遇到了同样的问题。 I spend 1.5 day and any of these 30 answers solved my problem.我花了 1.5 天,这 30 个答案中的任何一个都解决了我的问题。 Finally I run the visual studio installer exe and select repair option.最后我运行 Visual Studio 安装程序 exe 并选择修复选项。 So my configuration was reset and problem is completely gone.所以我的配置被重置,问题完全消失了。

If you find none of the above solutions works, try this.如果您发现上述解决方案均无效,请尝试此操作。

RIGHT CLICK PROJECT -> Properties -> BUILD -> Advanced.右键单击项目 -> 属性 -> 构建 -> 高级。 Change Debugging information from None to Pbd-only or full将调试信息从 None 更改为 Pbd-only 或 full

在此处输入图像描述

I solve this exact problem by:我通过以下方式解决了这个确切的问题:

  1. Open studio as administrator以管理员身份打开工作室
  2. Use Build->Clean Solution使用 Build->Clean 解决方案
  3. Use Build->Build使用构建->构建

Goto the project's properties then to the "Build" tab.转到项目的属性,然后转到“构建”选项卡。 Click "Advanced..." at the bottom and change Debugging Information to "Full"单击底部的“高级...”并将调试信息更改为“完整” 在此处输入图像描述

在尝试在 VS 2013 中调试 Excel 插件时,在我通过禁用 DotNet 框架源步进和禁用符号加载尝试了所有 Debug 设置之后,最终对我有用的是将 Configuration Setting 更改为 Release 而不是 Debug ,因为编译器似乎越过代码,断点最终被击中。

I went through all answers nothing helped much.我浏览了所有答案,没有什么帮助。 In my case problem with web.config file.就我而言, web.config文件存在问题。 It was <compilation debug="false" strict="true"这是<compilation debug="false" strict="true"

I changed to我改为

<compilation debug="true" strict="false" . <compilation debug="true" strict="false" Now I can debug application.现在我可以调试应用程序了。

I'd like to add one more thing that can prevent stepping/breaking by not loading the .pdb file, after not finding this in any other forum: if you add a build post-process to add resource meta-data to the DLL (company name, version number, etc), as in "rc.exe my_dll.rc", this may be causing a mis-match between the DLL and the .pdb file.在任何其他论坛中没有找到此内容之后,我想再添加一件事可以通过不加载 .pdb 文件来防止步进/中断:如果您添加构建后处理以将资源元数据添加到 DLL (公司名称、版本号等),如“rc.exe my_dll.rc”,这可能会导致 DLL 和 .pdb 文件不匹配。 If the signatures don't match, it won't load the file and all the symbols you need for debugging.如果签名不匹配,它将不会加载文件和调试所需的所有符号。 Remove this from the debug build.从调试版本中删除它。

Make sure your code is not getting thrown out at link time.确保您的代码不会在链接时被抛出。 Even though the compiler may rebuild an object, if the linker sees no reference to the code it will toss it out and cause this error when attempting to set a breakpoint.即使编译器可能重建对象,如果链接器没有看到对代码的引用,它也会将其丢弃并在尝试设置断点时导致此错误。

我个人的情况是调试在最初创建它的 Visual Studio 2013 中工作,但在 2015 年无法工作。我能够通过将项目文件中的版本更改为版本 12 而不是版本 10 来解决此问题。

就我而言,在AssemblyInfo.cs文件中,有以下行,我对其进行了评论,一切都是正确的:

[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]

I ended up tracing my issue back to an apparent incompatibility issue with using multiple PostSharp versions .我最终将我的问题追溯到使用多个 PostSharp 版本的明显不兼容问题。 The app I was attempting to debug had a previous version of PostSharp but was referencing a project which was using a more recent version, and for one reason or another this resulted in VS refusing to generate the PDB file for specifically that app (all other DLLs were loading their debug symbols fine).我试图调试的应用程序具有 PostSharp 的早期版本,但引用了一个使用更新版本的项目,出于某种原因,这导致 VS 拒绝专门为该应用程序生成 PDB 文件(所有其他 DLL加载他们的调试符号很好)。

The solution was to update PostSharp within each project to the most recent version and recompile.解决方案是将每个项目中的 PostSharp 更新为最新版本并重新编译。

In my case, it was because my publishing profile (Publish to local IIS site) was somehow set to Release Configuration, despite the fact that the global build configuration was set to Debug.就我而言,这是因为我的发布配置文件(发布到本地 IIS 站点)以某种方式设置为发布配置,尽管全局构建配置设置为调试。 Modified the publishing profile to Debug configuration solved the issue for me.将发布配置文件修改为调试配置为我解决了这个问题。

In my case this started happening after a Windows Update , turns out the windows update turned off Internet Information Services which was making it appear that my API was unable to hit the break-point that I had set, but what was actually happening was that IIS was failing to start and therefore my application code wasn't actually running.在我的情况下,这在 Windows Update 之后开始发生,结果是 Windows 更新关闭了 Internet 信息服务,这使得我的 API 似乎无法达到我设置的断点,但实际发生的是 IIS无法启动,因此我的应用程序代码实际上并未运行。

Double check that Internet Information Services is enabled in the Windows Features menu.仔细检查 Windows 功能菜单中是否启用了 Internet 信息服务。

Instructions for IIS: IIS 使用说明:

  • control panel控制面板
  • Programs程式
  • open or close windows features打开或关闭窗口功能
  • tick internet information services勾选互联网信息服务
  • restart visual studio重新启动视觉工作室

If using IIS Express:如果使用 IIS Express:

Open 'Add/Remove Programs' from the old control panel and run a repair on IIS Express Or you might go Control Panel ->> Programs ->> Programs and Features ->> Turn Windows features on or off ->> Internet Information Services and check the parent Internet Information Services folder.从旧控制面板打开“添加/删除程序”并在 IIS Express 上运行修复 或者您可以转到控制面板 ->> 程序 ->> 程序和功能 ->> 打开或关闭 Windows 功能 ->> Internet 信息服务并检查父 Internet 信息服务文件夹。

I got this answer here: Specified argument was out of the range of valid values.我在这里得到了这个答案: 指定的参数超出了有效值的范围。 Parameter name: site 参数名称:站点

In my case, I was debugging a WPF extension using Visual Studio's Experimental Instance.就我而言,我正在使用 Visual Studio 的实验实例调试 WPF 扩展。 After starting debugging and then pausing the dubugger, I opened the Debug > Windows > Modules window.开始调试然后暂停调试器后,我打开了Debug > Windows > Modules窗口。 Form there, I could see the directory where Visual Studio was trying to load symbols C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\15.0_76a9e536Exp\Extensions\<companyName> .在那里,我可以看到 Visual Studio 试图加载符号C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\15.0_76a9e536Exp\Extensions\<companyName>的目录。 After stopping debugging, I deleted the target folder using Windows Explorer and restarted the debugger.停止调试后,我使用 Windows 资源管理器删除了目标文件夹并重新启动了调试器。 Visual Studio was then able to hit the breakpoint.然后,Visual Studio 能够命中断点。

In my case, none of these solutions worked.就我而言,这些解决方案都不起作用。 I had to go to我不得不去

Tools -> Import and Export Settings -> Reset all settings.工具 -> 导入和导出设置 -> 重置所有设置。

and then debugging started working without any issues.然后调试开始工作,没有任何问题。

If you are using a C++ project or dll from a C# or any .Net project, and you want to debug into the native code.如果您使用的是C++项目或来自C#或任何.Net项目的dll ,并且您想调试到本机代码。 Then go to the .Net Project Properties -> Debug -> Enable native code debugging (set it to true).然后转到.Net项目属性 -> 调试 -> 启用本机代码调试(将其设置为 true)。

As stupid as it may sound, be 101% sure that you are referencing the right class.尽管听起来很愚蠢,但要 101% 确定您引用了正确的类。

In my case I have a GameObject in which I added the wrong script to the components.在我的情况下,我有一个 GameObject,我在其中向组件添加了错误的脚本。 Hence, there is no way for Visual Studio to actually reach the code.因此,Visual Studio 无法实际访问代码。

I simply had to delete the wrong C# script and component and add right one.我只需要删除错误的 C# 脚本和组件并添加正确的。

UWP:超轻量级:

If you are debugging a Universal Windows Project [UWP] , the process is similar to solutions with mixed C# and Native code , Except you need to set the Application process or the Background Task process debugger to Managed Only to debug you C# code.如果您正在调试通用 Windows 项目[UWP] ,则该过程类似于混合 C# 和本机代码的解决方案,除了您需要将应用程序进程或后台任务进程调试器设置为仅托管来调试您的 C# 代码。

  1. Right-click your Startup Project in Solution Explorer在解决方案资源管理器中右键单击您的启动项目
  2. Select Properties选择属性
  3. Select "Debug" tab选择“调试”选项卡
  4. Set process debugger type to Managed Only将进程调试器类型设置为仅托管

在此处输入图像描述

Left field answer here.左场答案在这里。 I had a solution with a few projects, and because they had the same port number Visual Studio was starting the wrong project.我有几个项目的解决方案,因为它们具有相同的端口号,Visual Studio 启动了错误的项目。 So yeah, the debug symbols weren't loaded for my breakpoint...所以,是的,没有为我的断点加载调试符号......

I managed to end up with two copies of a file with the same class in it.我最终得到了一个文件的两个副本,其中包含相同的类。 Both were open in Visual Studio, but they had different file names and one was actually included with the project and one was not.两者都在 Visual Studio 中打开,但它们具有不同的文件名,其中一个实际上包含在项目中,而一个没有。

Make sure the breakpoints you are setting are in a file that is actually being compiled by your solution/project.确保您设置的断点位于您的解决方案/项目实际正在编译的文件中。 There are no symbols for a file that isn't being compiled.未编译的文件没有符号。

Yet Another solution for some cases where this error occurs: check your Build Action .在发生此错误的某些情况下,另一种解决方案是:检查您的Build Action

I had this issue in an asp.net MVC3 project;我在一个 asp.net MVC3 项目中遇到了这个问题; one of my controllers had for some unknown reason it's Build Action set to EntityDeploy although it should have been Compile .我的一个控制器由于某种未知原因将 Build Action 设置为 EntityDeploy 尽管它应该是Compile

I've done the clean and rebuild thing.我已经完成了干净和重建的事情。 That didn't work (it usually does).那没有用(通常是这样)。 Now, I am attaching to w3wp before calling through the service, then let it call the service once, hit another breakpoint, then I change the point of execution so that it will run the same line (calling the service) again, then it actually stops at my breakpoint inside the service method.现在,我在通过服务调用之前附加到 w3wp,然后让它调用服务一次,命中另一个断点,然后我更改执行点,以便它再次运行同一行(调用服务),然后它实际上在服务方法内的断点处停止。

None of the ideas here worked for me but I thank everyone for their efforts - in my case it was a Windows application that referenced a class library project - I could debug the windows application but not the class library.这里没有一个想法对我有用,但我感谢大家的努力——在我的例子中,它是一个引用类库项目的 Windows 应用程序——我可以调试 Windows 应用程序,但不能调试类库。 The pdb files were being generated.正在生成 pdb 文件。 I did however find that if I debug on the call to the class library, I could step into the library.然而,我确实发现,如果我调试对类库的调用,我可以进入类库。

我在 2013 年启动 ASP.NET 网站时发生过这种情况。在我的情况下,一旦网络浏览器完全启动,它就会消失。

Had the problem when trying to debug a silverlight application in a sharepoint project.尝试在 sharepoint 项目中调试 silverlight 应用程序时出现问题。 Under the sharepoint tab of the project properties you have to explicitly enable debugging for silverlight applications.在项目属性的 sharepoint 选项卡下,您必须明确启用 silverlight 应用程序的调试。 Else you get this error.否则你会得到这个错误。

Maybe you should not have been making an AutoPostBack .也许您不应该制作AutoPostBack
If your code doesn't make a PostBack, you can get this error.如果您的代码没有进行 PostBack,您可能会收到此错误。
Regards.问候。

I was using IE8 and trying to make changes to some JavaScript files.我正在使用 IE8 并尝试对一些 JavaScript 文件进行更改。 Although the code was being executed, it would not stop at the breakpoints and I was getting the same message on the breakpoints.尽管代码正在执行,但它不会在断点处停止,并且我在断点处收到相同的消息。 Upgrading to IE11 fixed the issue for me.升级到 IE11 为我解决了这个问题。

In my situation, the Visual Studio loads the DLLs in Global Assembly Cache (GAC) , not the DLL in my project list.在我的情况下,Visual Studio 加载全局程序集缓存 (GAC)中的 DLL,而不是我的项目列表中的 DLL。 I deleted the DLLs in GAC and now I can see the break point working.我删除了 GAC 中的 DLL,现在我可以看到断点正常工作。

For me:为了我:

  • Open solution properties打开解决方案属性
  • Select "Common Properties"/"Debug Source Files"选择“通用属性”/“调试源文件”
  • In the "Do not look for these source files" window, remove the files that are almost certainly there erroneously.在“不查找这些源文件”窗口中,删除几乎可以肯定错误地存在的文件。

Yet another tip that worked for me.另一个对我有用的技巧。

If your project / library is signed, not even delay signed, it still may not be debuggable.如果您的项目/库已签名,甚至没有延迟签名,它仍然可能无法调试。 Try disabling the signing option, debugging it, then restoring the signing option.尝试禁用签名选项,调试它,然后恢复签名选项。

My coworker had this problem, followed similar steps as those here, but the solution was different than any of these given.我的同事遇到了这个问题,遵循了与此处类似的步骤,但解决方案与给出的任何一个都不同。

The code she wanted to debug was in a project referenced by the current project, and it was never running within the Visual Studio session.她要调试的代码位于当前项目引用的项目中,并且从未在 Visual Studio 会话中运行。 The DLL was running from the GAC folder, after she deleted that the project wouldn't run at all, throwing an exception as soon as it tried to run. DLL 是从 GAC 文件夹中运行的,在她删除该项目根本无法运行之后,它一尝试运行就抛出异常。 The solution was to include the referenced project in the local folder.解决方案是将引用的项目包含在本地文件夹中。

From the SolutionExplorer:从解决方案资源管理器:

  1. Select the "debugging" project you will run out of选择您将用完的“调试”项目
  2. Expand References (if not visible, select menu Project , item Show all files )展开参考(如果不可见,选择菜单项目,项目显示所有文件
  3. Right-click the project which has the break point that is not working, select Properties右键单击具有不工作的断点的项目,选择属性
  4. Change value of Copy Local from False to True将 Copy Local的值从False更改为True

Try again.再试一次。 (It worked for her!) (这对她有用!)

对我来说,另一个解决方案是后期构建无法进入主项目的 bin 文件夹的项目。

Also had this issue with a Qt .pro generated project. Qt .pro 生成的项目也有这个问题。 It turned out I forgot to set an environment variable which determines the properties/general/Output Directory.原来我忘了设置一个环境变量来确定属性/通用/输出目录。 Trivial one, and one to look at in the first place, but sometimes we miss the obvious.一个微不足道的,一个首先要看的,但有时我们会错过明显的东西。

I had accidently opened the project file in a text editor and it was unloaded.我不小心在文本编辑器中打开了项目文件,它被卸载了。 Unlikely, but check it out if you're stuck.不太可能,但是如果您遇到困难,请检查一下。

I realize this is an old thread, but for the benefit of others here is what happened to me.我意识到这是一个旧线程,但为了其他人的利益,这就是发生在我身上的事情。 The issue was in how I applied the Designer attribute.问题在于我如何应用 Designer 属性。 I created a designer class.我创建了一个设计师课程。 The designer overrode PrefilterProperties to make the Anchor, AutoScroll and AutoSize properties read only.设计器覆盖 PrefilterProperties 以使 Anchor、AutoScroll 和 AutoSize 属性为只读。

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
public class j2aScrollableContainerDesigner : ParentControlDesigner

I created a class and added my designer to it.我创建了一个类并将我的设计师添加到其中。 This is the standard way to attach a designer attribute to a class and is found in many MSDN examples.这是将设计器属性附加到类的标准方法,在许多 MSDN 示例中都可以找到。 The designer was obviously not being used because when I placed my control on a Form design surface, none of the properties mentioned above were read only in the Property Grid.设计器显然没有被使用,因为当我将控件放在窗体设计图面上时,上面提到的所有属性都不是只读属性网格中的。

[Designer(typeof(j2aScrollableContainerDesigner), typeof(ParentControlDesigner))]
public partial class j2aScrollableContainer : UserControl

Out of desperation, I changed the Designer attribute declaration on my class to the following signature and the designer was now called.出于绝望,我将类上的 Designer 属性声明更改为以下签名,现在调用了设计器。 I have no explanation as to why one way works and the other doesn't.我无法解释为什么一种方法有效而另一种方法无效。 If I revert to the above Designer attribute declaration, the designer will quit working again.如果我恢复到上面的 Designer 属性声明,设计师将再次退出工作。

[Designer(typeof(j2aScrollableContainerDesigner))]
public partial class j2aScrollableContainer : UserControl

我的丢失主要是因为我有 2 个项目停在同一个 IISExpress URL,请确保指定不同的端口并点击 CreateVirtualDirectory。

This can be cause by a test project, web project, or other execution project having a Nuget reference to a project with the same name as the module being loaded.这可能是由于测试项目、Web 项目或其他执行项目具有对与正在加载的模块同名的项目的 Nuget 引用。

Take the following example projects in a solution:在解决方案中采用以下示例项目:

  • Vendor.ABC
  • MyLib (references Vendor.ABC) MyLib (参考 Vendor.ABC)
  • MyProg (console program: referencing MyLib only) MyProg (控制台程序:仅引用 MyLib)
  • MyProg.Web (MVC project: references MyLib and solution project Vendor.ABC) MyProg.Web (MVC 项目:参考 MyLib 和解决方案项目 Vendor.ABC)
  • MyLib.Test (Test Project: references MyLib and Nuget package Vendor.ABC) MyLib.Test (测试项目:参考 MyLib 和 Nuget 包 Vendor.ABC)

MyProg and MyProg.Web will both load the debug symbols. MyProgMyProg.Web都将加载调试符号。 MyLib.Test will not load debug symbols. MyLib.Test不会加载调试符号。

Project > Properties > C++ > General > Debug Information Format - Program Database (/Zi)项目 > 属性 > C++ > 常规 > 调试信息格式-程序数据库 (/Zi)

I had checked Linker > Debugging and was already generating debug info.我已经检查了Linker > Debugging并且已经在生成调试信息。 When I launched the application, symbols were loaded ( Debug > Windows > Modules ).当我启动应用程序时,符号被加载( Debug > Windows > Modules )。 Setting the Debug Information Format fixed it for me.设置调试信息格式为我修复了它。 Hope this helps someone!希望这对某人有帮助!

Main project has both Project Reference and File reference to same project.主项目具有对同一项目的项目参考和文件参考。

In my case, the main project had two references one was a project reference and another File reference, to the dll generated by same project.就我而言,主项目有两个引用,一个是项目引用,另一个是文件引用,指向同一项目生成的 dll。

Thus, pdb file was not being copied to Main project's bin folder, leading to unavailability of the symbols.因此,pdb 文件没有被复制到主项目的 bin 文件夹,导致符号不可用。

Sometimes IIS will hold on to files for some reason.有时 IIS 会出于某种原因保留文件。 I had to delete the website and create it anew and the problem went away我不得不删除该网站并重新创建它,问题就消失了

Check if you have enabled "Enable just my code".检查您是否启用了“仅启用我的代码”。 If yes, disable it.如果是,请禁用它。

I had set a breakpoint and got this message on that breakpoint when executing the code.我设置了一个断点,并在执行代码时在该断点上收到了这条消息。 However, the breakpoint was only accessible to a unit test.但是,断点只能由单元测试访问。 I had to right click the unit test and select "debug unit tests" Doh!我必须右键单击单元测试并选择“调试单元测试”Doh!

Using Dependency Injection, Autofac in my case, to automatically resolve by scanning assemblies.使用依赖注入,在我的例子中是 Autofac,通过扫描程序集来自动解决。 One of the referenced assemblies was not getting resolved.引用的程序集之一没有得到解决。

My fix was to directly reference a class from the assembly to force Visual Studio to load the assembly.我的解决方法是直接从程序集中引用一个类来强制 Visual Studio 加载程序集。 Just having the assembly as a reference will not load the assembly when the application runs.仅将程序集作为参考将不会在应用程序运行时加载程序集。

My reason was deprecated Telerik OpenAccess ORM.我的理由是不推荐使用 Telerik OpenAccess ORM。 Installed new version then it works.安装新版本就可以了。 Must download and install.必须下载安装。 Only NuGet updating did not work.只有 NuGet 更新不起作用。 someone else also mentioned it 其他人也提到过

Will put this here in the hope that it helps someone.将其放在这里,希望对某人有所帮助。

I had the missing symbols issue with regards to a web service.关于网络服务,我遇到了缺少符号的问题。

The daft solution was that the setup project was not set to build when the solution was built, which meant that when I right clicked the setup project and installed the service, then attached to the process;愚蠢的解决方案是在构建解决方案时设置项目没有设置为构建,这意味着当我右键单击设置项目并安装服务时,然后附加到进程; the same out of date service was being installed without the pdb because it didn't match = no working breakpoints.在没有 pdb 的情况下安装了相同的过时服务,因为它不匹配 = 没有工作断点。

The manual solution was to right click the setup project and build it, then install from it.手动解决方案是右键单击安装项目并构建它,然后从中安装。 I then altered the solution project build list to include the setup project when the solution is built in debug mode.然后,当解决方案以调试模式构建时,我更改了解决方案项目构建列表以包含安装项目。

It is also worth to mention that in some situations the problem occurs, because the project you want to debug is an external service.还值得一提的是,在某些情况下会出现问题,因为您要调试的项目是外部服务。 In that case you have to attach debugger to the running process.在这种情况下,您必须将调试器附加到正在运行的进程。

对于我的 Xamarin 应用程序,在我完全擦除源代码管理文件夹、执行“获取最新”并重建解决方案后,它终于开始调试。

A new way to get this problem has appeared as of Visual Studio 2017 15.3.1 through 15.3.5.从 Visual Studio 2017 15.3.1 到 15.3.5 出现了解决此问题的新方法。 If you are using EditorConfig , the charset=utf8 option causes these symptoms.如果您使用的是EditorConfig ,则 charset=utf8 选项会导致这些症状。 The VS team has reproduced this and says they are working on it . VS 团队已经复制了这一点,并表示他们正在努力

So one fix is to comment out your charset=utf8 line in the .editorconfig file.因此,一种解决方法是在 .editorconfig 文件中注释掉您的 charset=utf8 行。

Status is now "Fixed - pending release" as of October 9, 2017.截至 2017 年 10 月 9 日,状态现在为“已修复 - 待发布”。

(Thanks to John Hatton, "The breakpoint will not currently be hit. The source code is different from the original version." What does this mean? (感谢 John Hatton, “当前不会命中断点。源代码与原始版本不同。”这是什么意思?

No meu caso dei um F11 na chamada do método, forçando entrar no método onde o BP com problema estava, sendo assim, o break point foi recuperado. No meu caso dei um F11 na chamada do método, forçando entrar no método onde o BP com problema estava, sendo assim, o break point foi recuperado。

In my case I gave an F11 in the method call, forcing to enter the method where the problem BP was, so the break point was recovered.在我的情况下,我在方法调用中给了一个 F11,强制进入问题 BP 所在的方法,因此断点被恢复。

There are many answers with many different solutions to fix this issue.有许多不同的解决方案可以解决此问题。

Another solution is to make sure that your code is reachable.另一种解决方案是确保您的代码是可访问的。 For example:例如:

Any code that is added after a Return in a function.在函数中的 Return 之后添加的任何代码。 Adding a GOTO that effectively skips your code that has the break point.添加一个 GOTO 可以有效地跳过具有断点的代码。

I'm not saying these are normal but they are also causes.我不是说这些是正常的,但它们也是原因。

When debugging an assembly by starting an external application there are some extra considerations:通过启动外部应用程序调试程序集时,有一些额外的注意事项:

  • The external app may load its own copies of assemblies (DLLs) from a manifest file.外部应用程序可以从清单文件加载它自己的程序集 (DLL) 副本。 (eg, file appname.exe.manifest ) If so, you need to disable this possibly by manually altering the manifest. (例如,文件appname.exe.manifest )如果是这样,您可能需要通过手动更改清单来禁用它。

  • The external app may just try to load from DLLs in its own folder, even without a manifest.即使没有清单,外部应用程序也可能只是尝试从其自己的文件夹中的 DLL 加载。 You will have to remove / rename these.您将不得不删除/重命名这些。

With these steps taken care of, the version of the assembly running in the debugger should be correctly loaded and can be debugged normally.处理好这些步骤后,在调试器中运行的程序集版本应该可以正确加载并且可以正常调试。

I had same problem, checked all the previous solutions but didn't work for me.我有同样的问题,检查了所有以前的解决方案,但对我不起作用。 Simple but added answer just to make sure people don't get stuck on this not to exist problem as I did.简单但添加的答案只是为了确保人们不会像我一样陷入这个不存在的问题。

What worked for me was, I was running VS 2013 on admin mode and running on normal mode did the trick.对我有用的是,我在管理员模式下运行 VS 2013 并在正常模式下运行就可以了。 Tried multiple times switching to normal and admin mode and its consistently working fine.多次尝试切换到正常和管理模式,并且始终正常工作。

IDE: VS 2013 Professional
Version: 12.0.40629.00 Update 5

I had this problem.我有这个问题。

My issue was that the aspx, aspx.vb and aspx.designer.vb files were imported wrong (Perhaps they were imported one by one to the project).我的问题是aspx、aspx.vb和aspx.designer.vb文件导入错误(可能是一一导入到项目中)。

The breakpoint were in the aspx.vb, but was unreachable and had the warning of this question.断点在 aspx.vb 中,但无法访问,并且有此问题的警告。

The solution was to delete the three files and import them again.解决方案是删除这三个文件并再次导入。 Now I can reach the breakpoint.现在我可以到达断点。

it was so easyyyy.太容易了。 it also happend for me because .pdb file of the project have not copy in debug\Bin folder then it could not load symboles (.pdb file) in debug mode .它也发生在我身上,因为项目的 .pdb 文件没有复制到 debug\Bin 文件夹中,然后它无法在调试模式下加载符号(.pdb 文件)。 in this way : you must rebuild your target project and manually copy the symboles (.pdb file) in debug\Bin folder of execute project这样:您必须重新构建目标项目并手动复制执行项目的 debug\Bin 文件夹中的符号(.pdb 文件)

I test all answers for this question not work for me, I use this below method:我测试了这个问题的所有答案对我不起作用,我使用以下方法:

I exclude that file(s) has breakpoints from project where that visual studio can't hits them and then I includes them into my project and worked breakpoints.我从项目中排除了该文件具有该 Visual Studio 无法命中它们的断点,然后我将它们包含到我的项目中并工作断点。

Make sure your files are open from the relevant project, not from another (old) one.确保您的文件是从相关项目中打开的,而不是从另一个(旧)项目中打开的。

Example:例子:

  • You working on a project, close the VS, but you left files (tabs) open in VS.您正在处理一个项目,关闭 VS,但您在 VS 中打开了文件(选项卡)。

  • Copy your project to a new folder and open solution.将您的项目复制到新文件夹并打开解决方案。 The files (tabs) will load from the old directory and if you want to debug then you cannot debug until you close them and reload them from the current folder.文件(选项卡)将从旧目录加载,如果要调试,则在关闭它们并从当前文件夹重新加载它们之前无法调试。

I was very close to reinstall my VS because nothing helped for me from another answers, but fortunately I realised this in my project and I can debug now.我非常接近重新安装我的 VS,因为其他答案对我没有任何帮助,但幸运的是我在我的项目中意识到了这一点,我现在可以调试了。

Had this problem yesterday with a Web Project, tried many of the solutions proposed here and didnt work.昨天在一个 Web 项目中遇到了这个问题,尝试了这里提出的许多解决方案,但没有奏效。

How did I solve?我是怎么解决的?

Right click on the project -> Properties -> Web tab右键单击项目 ->属性-> Web选项卡

In Servers section I changed IIExpress for Local IIS , created the virtual dir, and voilá!服务器部分,我将IIExpress更改为Local IIS ,创建了虚拟目录,瞧!

检查 csproj 文件中是否有<DebugType>Full</DebugType>的行/条目如果存在,则尝试将其删除并再次尝试调试

Maybe I can add something new.也许我可以添加一些新的东西。 Unless I missed something (possible!) in these many posts, there doesn't appear to be an accepted solution or any mention of System.Reflection.Assembly.LoadFrom(filename) which is the method .NET provides when you need explicit control.除非我在这么多帖子中遗漏了某些东西(可能!),否则似乎没有被接受的解决方案或任何提及System.Reflection.Assembly.LoadFrom(filename)的方法,这是 .NET 在您需要显式控制时提供的方法。 If the Modules tab shows assemblies loading from unexpected locations, this is how you can fix that and get your debug breaks back.如果“模块”选项卡显示从意外位置加载的程序集,这就是您可以修复该问题并恢复调试中断的方法。

Sometimes there are very good reasons for doing this.有时这样做有很好的理由。 For me, it was when I was supporting a platform that allowed users to create somewhat arbitrary plug-ins, and I had to be careful about having a race with those plugins about where the common assemblies get loaded from.对我来说,那是在我支持一个允许用户创建一些任意插件的平台时,我不得不小心地与那些插件竞争公共程序集的加载位置。 The goal was to make sure the "golden" versions living in the same directory as my Platform.exe would ALWAYS be the ones to load without exception.目标是确保与我的 Platform.exe 位于同一目录中的“黄金”版本总是可以毫无例外地加载。 (Putting them in the GAC is sometimes the right answer but not always). (将它们放入 GAC 有时是正确的答案,但并非总是如此)。

I has been rightly mentioned in other posts that default build settings cause referenced assemblies to get copied locally in the \bin of the plug in when it builds.我在其他帖子中正确地提到了默认构建设置会导致在构建时将引用的程序集本地复制到插件的 \bin 中。 Plug-ins are one example of a use case where that's the total opposite of what you want to happen.插件是一个与您想要发生的完全相反的用例示例。 There might be 100 users with 100 plugins and 100 copies of a given assembly.可能有 100 个用户拥有 100 个插件和给定程序集的 100 个副本。 Which one of the 100 will load? 100 个中的哪一个会加载? And will it be the latest, correct version?它会是最新的、正确的版本吗?

Here's how I was able to do this reliably for a real-world platform that I supported for more than a decade, loading assemblies up-front.以下是我如何能够为我支持了十多年的真实平台可靠地做到这一点,预先加载程序集。

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

[STAThread]
static void Main()
{
    PreLoadAssemblies();
    Form appInstance = new InstanceManager();
    Application.Run(appInstance);
}

private static void PreLoadAssemblies()
{
    // Obtain an explicit folder path relative to where
    // the main executable ("Platform.exe") is running.
    string dir =
        Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) +
        @"\Accessories\PlugIn\google-drive-sync\netstandard2.0";

    PreLoadAssembly(dir, "Google.Apis.Auth.dll");
    PreLoadAssembly(dir, "Google.Apis.Drive.v3.dll");
    PreLoadAssembly(dir, "Google.Apis.Auth.PlatformServices.dll");
    PreLoadAssembly(dir, "Google.Apis.dll");
    PreLoadAssembly(dir, "Google.Apis.Core.dll");
    PreLoadAssembly(dir, "Google.Apis.PlatformServices.dll");
    PreLoadAssembly(dir, "Newtonsoft.Json.v10.dll");
}

private static void PreLoadAssembly(string dir, string name)
{
    try
    {
        Assembly resolved = Assembly.LoadFrom(dir + @"\" + name);
        Debug.Assert(resolved != null);
    }
    catch (Exception ex)
    {
        Debug.Assert(false, ex.Message);
    }
}

I had the same problem.我有同样的问题。 I tried EVERYTHING in this post.我在这篇文章中尝试了一切。

My solution?我的解决方案?

Change the Visual Studio version (I was trying to open it on VS2013, ended up opening it on VS2015)更改 Visual Studio 版本(我试图在 VS2013 上打开它,最终在 VS2015 上打开它)

For me, the test class was annotated with [Ignore] .对我来说,测试类用[Ignore]注释。 I don't know why it was still showing up in the test explorer, but whatever.我不知道为什么它仍然出现在测试资源管理器中,但无论如何。 This is with the Visual Studio Unit Testing Framework.这与 Visual Studio 单元测试框架有关。

在此处输入图像描述

I tried all of the answers posted here and I did not work.我尝试了此处发布的所有答案,但我没有工作。 For me the solution was to check "launch browser"对我来说,解决方案是检查“启动浏览器” 在此处输入图像描述

My experience is in trying to remotely debug a web app I deployed to an AWS server.我的经验是尝试远程调试我部署到 AWS 服务器的 Web 应用程序。 The problem is that when I deploy to the server, it compiles and creates the exe and pdb files at that time.问题是当我部署到服务器时,它会编译并创建 exe 和 pdb 文件。 But the local compiled exe and pdb file does not match the deployed files on the server, so when I attach to the remote process and then try to load symbols in Debug/Windows/Modules for my project's DLL, it finds the local pdb file and I get an error "PDB does not match image."但是本地编译的 exe 和 pdb 文件与服务器上部署的文件不匹配,所以当我附加到远程进程然后尝试为我的项目的 DLL 加载 Debug/Windows/Modules 中的符号时,它会找到本地 pdb 文件和我收到错误消息“PDB 与图像不匹配”。

So after trying all the above suggestions, this is what I did to make breakpoints work:因此,在尝试了上述所有建议之后,这就是我使断点起作用的方法:

  • Connect and log in to the remote web server.连接并登录到远程 Web 服务器。
  • Go to the folder where the exe and pdb files are kept.转到保存 exe 和 pdb 文件的文件夹。 In my case, it was C:\inetpub\AspNetCoreWebApps\app.在我的例子中,它是 C:\inetpub\AspNetCoreWebApps\app。
  • Copy the *.pdb files in that folder.复制该文件夹中的 *.pdb 文件。
  • Paste the pdb files to your local computer where it's looking for the project's pdb files.将 pdb 文件粘贴到您正在查找项目的 pdb 文件的本地计算机上。 You will find the path in Debug/Windows/Modules, right-click your DLL and select Symbol Load Information...您将在 Debug/Windows/Modules 中找到路径,右键单击您的 DLL 并选择 Symbol Load Information...
  • Now you can use Debug/Attach to Process... to attach to the remote process and it should load the symbols since the pdb now matches the remote exe file.现在您可以使用 Debug/Attach to Process... 附加到远程进程,它应该加载符号,因为 pdb 现在与远程 exe 文件匹配。

Once you are done remote debugging, you can rebuild the project to restore the current pdb files so you can debug locally.完成远程调试后,您可以重建项目以恢复当前的 pdb 文件,以便您可以在本地进行调试。

It may be possible to add a path to the symbol path list that would load the pdbs from the remote server, but if there is I have not found it yet.可以向符号路径列表添加一个路径,该路径将从远程服务器加载 pdb,但如果有的话,我还没有找到它。 And that may be more cumbersome than simply copying the pdb files from the remote server to your local VS environment.这可能比简单地将 pdb 文件从远程服务器复制到本地 VS 环境更麻烦。

In my case, the problem was that I had added a new project/component, and I forgot to Sign it.就我而言,问题是我添加了一个新项目/组件,但我忘记了签名。 When other components in the solution are signed, your new ones need to be as well.当解决方案中的其他组件被签名时,您的新组件也需要被签名。 So solution for me was to copy the snk-file (from another project) into the new projects folder, and then from project properties / Signing choose it.所以我的解决方案是将 snk 文件(来自另一个项目)复制到新项目文件夹中,然后从项目属性/签名中选择它。

Another issue may be if the team is using different versions of VS or if someone is using Rider and some VS, they may use different casing on the project GUID.另一个问题可能是如果团队使用不同版本的 VS,或者如果有人使用 Rider 和某些 VS,他们可能会在项目 GUID 上使用不同的大小写。

My situation was with Visual Studio 2019 and we have both C# and C++ code.我的情况是使用 Visual Studio 2019,我们同时拥有 C# 和 C++ 代码。 Not sure what I screwed up, but the solution was to change from auto to Native as the C# code was working.不知道我搞砸了什么,但解决方案是在 C# 代码正常工作时从 auto 更改为 Native。

Debug -> Attach to Process... and where it says Attach to: select native code (in my case). Debug -> Attach to Process...并在其中显示 Attach to: 选择本机代码(在我的情况下)。 Find the process in question and voila.找到有问题的过程,瞧。

In my case it was a package called Strong Namer included with another Nuget that caused the issue.在我的情况下,它是一个名为Strong Namer 的包,它包含在另一个 Nuget 中,导致了这个问题。 Removing Strong Namer resolved the problem.删除 Strong Namer 解决了这个问题。

Alternatively, especially when there is a dependency on the Strong Namer package, signing the project with a strong name key will solve the problem as well.或者,特别是当依赖于 Strong Namer 包时,使用强名称密钥对项目进行签名也可以解决问题。

I had a ASP.NET project with this problem.我有一个遇到这个问题的 ASP.NET 项目。 It seems that some temporary files were involved and the project loads an old file, not the current file.似乎涉及一些临时文件,并且该项目加载了一个旧文件,而不是当前文件。 Changing the folder name of solution resolved this problem.更改解决方案的文件夹名称可解决此问题。

After reviewing all of the above, this solved it for me in VS2019 - Tools > Options > Un-check "Require source files to exactly match the original version":在查看了以上所有内容后,这在 VS2019 中为我解决了 - 工具 > 选项 > 取消选中“要求源文件与原始版本完全匹配”:

enter image description here在此处输入图像描述

I have a blazor webassembly project and tried almost everything from the answers but nothing worked and the solution was to use Chrome instead of Firefox and the breakpoint was reached.我有一个 blazor webassembly 项目并尝试了几乎所有答案,但没有任何效果,解决方案是使用 Chrome 而不是 Firefox 并达到断点。 Also the docs for blazor webassembly saying the following还有 blazor webassembly 的文档说以下

Visual Studio requires the Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE) option in Tools > Options > Debugging > General. Visual Studio 需要“工具”>“选项”>“调试”>“常规”中的“为 ASP.NET(Chrome、Edge 和 IE)启用 JavaScript 调试”选项。 This is the default setting for Visual Studio.这是 Visual Studio 的默认设置。 If debugging isn't working, confirm that the option is selected.如果调试不起作用,请确认已选择该选项。

Somebody had changed "launchBrowser": true to "launchBrowser": false in my launchSettings.json for my Blazor project.有人在我的launchSettings.json项目的 launchSettings.json 中将"launchBrowser": true更改为"launchBrowser": false

It did launched a browser but resulted in no breakpoints.它确实启动了浏览器,但没有导致断点。 So I´m not sure what launchBrowser even does.所以我不确定 launchBrowser 甚至可以做什么。

This took me over 4 hours to spot!这花了我4个多小时才发现! Adding it here just in case it might save somebody some time!在此处添加它以防万一它可能会节省一些时间!

What worked for me is that I went to Task Manager (Ctrl+Shift+Esc) -> Click on details, find the process you usually attach when debugging (eg w3wp.exe) and click on end task.对我有用的是我去了任务管理器(Ctrl+Shift+Esc)-> 单击详细信息,找到调试时通常附加的进程(例如 w3wp.exe),然后单击结束任务。

样本图像

If you have more than one project in your solution, may be the project you are debuging/breakpoint is not set as Startup Project.如果您的解决方案中有多个项目,可能是您正在调试的项目/断点未设置为启动项目。 In my case, i'm calling a web service from an other project in same solution, so the web service was not Startup Project and brfeakpoint was not hitting.I set the ws as startup project and started a new instance of the calling project.在我的例子中,我从同一解决方案中的其他项目调用 web 服务,因此 web 服务不是启动项目并且 brfeakpoint 没有命中。我将 ws 设置为启动项目并启动调用项目的新实例。 It worked for me.它对我有用。

One more answer for those using ASP.Net (framework) WSP application.对于那些使用 ASP.Net(框架)WSP 应用程序的人来说,还有一个答案。

The only way I could get VS to debug properly was to make sure debug="true" in your web.config on the compilation line:我能让 VS 正确调试的唯一方法是在compilation行的 web.config 中确保debug="true"

<compilation debug="true">

I ran into this problem trying to debug the background agent of a WP7 app.我在尝试调试 WP7 应用程序的后台代理时遇到了这个问题。 As it turned out, this debugging issue was only a symptom of the real problem: My background agent wasn't running at all in debug mode.事实证明,这个调试问题只是真正问题的一个症状:我的后台代理根本没有在调试模式下运行。 I had followed the following guide on how to implement a background agent: http://msdn.microsoft.com/en-us/library/hh202941(v=vs.92).aspx我遵循了以下关于如何实现后台代理的指南:http: //msdn.microsoft.com/en-us/library/hh202941 (v=vs.92).aspx

... but forgot to add ...但忘记添加

#define DEBUG_AGENT

which meant that my agent was never actually being started in debugging mode.这意味着我的代理实际上从未在调试模式下启动。 Once this line was added, the problem that this thread is about went away.添加此行后,该线程所涉及的问题就消失了。

Try clean building your solution.尝试干净构建您的解决方案。 Worked for me.为我工作。

因为另一个项目中的文件同名,可能是你有两个控制器同名

None of the above worked for me.以上都不适合我。 Somehow my code did load all symbols for x86 but not for x64.我的代码以某种方式加载了 x86 的所有符号,但没有加载 x64 的所有符号。 I fixed the issue after some trial and error by setting the Debugger Type in the Debug Properties to the following values:通过将调试属性中的调试器类型设置为以下值,我在反复试验后解决了这个问题:

  • Application process: Managed Only申请流程:仅限托管
  • Background task process: Managed Only后台任务进程:仅限托管

set these values to Managed Only将这些值设置为仅托管

after this change the symbols were correctly loaded on x64进行此更改后,符号已正确加载到 x64 上

In Visual Studio check在 Visual Studio 中检查

Build => Configuration Manager => Active solution configuration构建 => 配置管理器 => 活动解决方案配置

If it is set to Release rather than Debug no breakpoints will be hit.如果它设置为Release而不是Debug ,则不会命中断点。

As of VS2019 - 16.8.4, I used Microsoft Edge to make this work.从 VS2019 - 16.8.4 开始,我使用 Microsoft Edge 来完成这项工作。 I hope Microsoft will fix it in Firefox.我希望微软能在 Firefox 中修复它。

I was going mad trying to figure out why my JavaScript file would not debug and it took looking in the "Script Documents" (the loaded scripts) to realise my script was not there.我很想弄清楚为什么我的 JavaScript 文件无法调试,它需要查看“脚本文档”(加载的脚本)才能意识到我的脚本不存在。

The designer had edited the page headers and replaced my individual developer JavaScript files with a combined minified version.设计师已经编辑了页面标题,并用一个组合的缩小版本替换了我的个人开发者 JavaScript 文件。 I didn't realise until an half an hour's worth of googling and debugging attempts.直到半小时的谷歌搜索和调试尝试,我才意识到。

So basically I recommend looking in that list when debugging.所以基本上我建议在调试时查看该列表。 If it's not in there, it can't be debugged.如果它不在那里,则无法调试。 Doh.多哈。

The designer was doing the right thing.设计师做的是对的。 It just should have happened at the release stage, not the beta.它应该发生在发布阶段,而不是测试版。 A list of which script includes were minified would also be good, so it can be rebuilt for development.包含哪些脚本被缩小的列表也很好,因此可以重建它以进行开发。

BTW I tried the Modules stuff from previous answers, and obviously it was not that.顺便说一句,我从以前的答案中尝试了 Modules 的东西,显然不是这样。 The script was actually not being loaded in the project.该脚本实际上没有被加载到项目中。 Sigh.叹。

暂无
暂无

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

相关问题 断点当前不会被命中。 没有为该文档加载任何符号。 删除dll时 - The breakpoint will not currently be hit. No symbols have been loaded for this document. when debussing dll 当前不会命中断点。 未在 Unity 中为该文档加载任何符号 - The breakpoint will not currently be hit. No symbols have been loaded for this document in Unity VS-2012 :当前不会命中断点。 尚未为该文档加载任何符号 - VS-2012 : Breakpoint will not currently be hit. No symbols have been loaded for this document 附加调试器 - 当前不会触发断点。 没有为此文档加载任何符号 - Attach Debugger - The breakpoint will not be currently hit. No symbols have been loaded for this document 断点当前不会被击中。在Silverlight应用程序中没有为此文档加载任何符号 - The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application VS 2010,NUNit和“断点目前不会被击中。 没有为此文档加载任何符号“ - VS 2010, NUNit, and “The breakpoint will not currently be hit. No symbols have been loaded for this document” VS2015 目前不会命中断点。 没有为此文档加载任何符号 - VS2015 The breakpoint will not currently be hit. No symbols have been loaded for this document VS 2013断点目前不会被击中。 没有为此文档加载任何符号 - VS 2013 the breakpoint will not currently be hit. no symbols have been loaded for this document 此断点当前不会被命中。 在项目 asp.net web forms 中没有为此文档加载任何符号 - this breakpoint will not currently be hit. no symbols have been loaded for this document in project asp.net web forms Xamarin.Forms UWP项目断点当前不会被点击。 没有为该文档加载任何符号 - Xamarin.Forms UWP Project The breakpoint will not currently be hit. No symbols have been loaded for this document
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM