I have a Visual Studio solution with four C# projects in it. I want to step into the code of a supporting project in the solution from my main project, but when I use the "Step into" key, it just skips over the call into that other project. I've set breakpoints in the supporting project, and they're ignored, and I can't for the life of me get it to step into any references to that project.
我有一个Visual Studio解决方案,里面有四个C#项目。我想从我的主项目中进入解决方案中的支持项目的代码,但是当我使用“Step into”键时,它只是跳过对其他项目的调用。我在支持项目中设置了断点,它们被忽略了,我不能为我的生活让它进入任何对该项目的引用。
Everything is set to compile as "Debug", and I've seen Visual Studio warn me that my breakpoints won't be hit before - it doesn't do that in this case. It's as though it looks as though my code will debug, but then at run-time, there's a setting somewhere that tells Visual Studio not to step through the code in that project. All the other projects in my solutions debug without problems.
一切都设置为编译为“调试”,我已经看到Visual Studio警告我,我的断点将不会被击中 - 在这种情况下它不会这样做。就好像我的代码会调试一样,但是在运行时,有一个设置,告诉Visual Studio不要单步执行该项目中的代码。我的解决方案中的所有其他项目调试没有问题。
What box have I checked to cause this behavior?
我检查了什么盒子导致这种行为?
UPDATE FOR CLARITY: The "Just my code" option is currently disabled. Also, since the code belongs to a project in my same solution, I don't think the "Just my code" option applies here. I thought it only applied to pre-compiled code that I didn't have the source for, but since I have the source in my project, I don't think this option has any effect.
CLARITY更新:“Just my code”选项目前已禁用。此外,由于代码属于同一解决方案中的项目,我不认为“仅我的代码”选项适用于此处。我认为它只适用于我没有源代码的预编译代码,但由于我的项目中有源代码,我不认为这个选项有任何影响。
7 个解决方案
#1
7
One thing to check for is that your supporting project assembly has not been installed in the GAC. Open a command prompt and run the following to make sure...
要检查的一件事是您的支持项目组件尚未安装在GAC中。打开命令提示符并运行以下命令以确保...
gacutil /l assemblyName
gacutil / l assemblyName
#2
13
Not sure if this is it, but "Tools>Options>Debugging>General:Enable Just My Code" is a possibility. (I prefer to always leave this unchecked.)
不确定是不是这样,但“工具>选项>调试>常规:启用我的代码”是可能的。 (我更喜欢永远不加以控制。)
#3
13
It turns out that the assembly needed to be copied into the GAC before it could be debugged. Under the debugging option "Just my code", there's an option to suppress an error if you don't have any user code, and it was suppressing the following error:
事实证明,在调试之前,需要将程序集复制到GAC中。在调试选项“Just my code”下,如果您没有任何用户代码,可以选择禁止错误,并且它可以抑制以下错误:
The Following mobile was built either with optimizations enabled or without debug information. (Module name and path) To debug this module, change its build configuration to Debug mode.
以下移动设备是在启用优化或没有调试信息的情况下构建的。 (模块名称和路径)要调试此模块,请将其构建配置更改为调试模式。
Since I was building it in Debug configuration, I searched on that error message and got this:
由于我在Debug配置中构建它,我搜索了该错误消息并获得了:
Problem solved. I don't know why it needs to be in the GAC in order for me to step into the project, but it does. I don't ask why, I just ask how, and then I do it...
问题解决了。我不知道为什么它需要加入GAC才能让我进入项目,但确实如此。我不问为什么,我只问如何,然后我这样做......
#4
4
You need to ensure the supporting projects have pdb files or else Visual Studio will not have the necessary information to step through the code.
您需要确保支持项目具有pdb文件,否则Visual Studio将没有必要的信息来逐步执行代码。
#5
3
A couple of possibilities:
几种可能性:
-
There is a check box to step into "just my code". Its intent is to make it so you can't step into Microsoft's Framework code (unless you choose to by unchecking the box).
有一个复选框可以进入“只是我的代码”。它的目的是使它不能进入微软的框架代码(除非你选择通过取消选中框)。
-
You might try recompiling the supporting code to make sure the code you're debugging exactly matches the code file you're looking at. VS does care about this and will disable a breakpoint if you put it in the code file whose version doesn't match. Also, make sure the PDB file is in the same directory as the DLL.
您可以尝试重新编译支持代码,以确保您正在调试的代码与您正在查看的代码文件完全匹配。 VS确实关心这一点,如果你将断点放在版本不匹配的代码文件中,它将禁用断点。此外,请确保PDB文件与DLL位于同一目录中。
#6
2
If you have the source code for the dll's into which you are trying to step into, do the following:
如果您有要尝试进入的dll的源代码,请执行以下操作:
- Click on the project in which these dll's are added as reference and remove them.
- Add the Project(s) corresponding to the dll(s) to the solution
- Right click on the project -> Add Reference -> Choose the newly added Project(s).
单击添加了这些dll的项目作为参考并删除它们。
将对应于dll的项目添加到解决方案中
右键单击项目 - >添加引用 - >选择新添加的项目。
Now set the break point and debug the code.. You will be able to step into the code.
现在设置断点并调试代码..您将能够进入代码。
The reason for the issue is because you program is still referencing the old dll (without the source code) as it has been added to your project as a reference. Once you remove that dll and add the Project (Source code of the dll) of the dll, Visual studio will be able to step into your code.
问题的原因是因为您的程序仍然引用旧的dll(没有源代码),因为它已作为参考添加到您的项目中。删除该dll并添加dll的Project(dll的源代码)后,Visual Studio将能够进入您的代码。
#7
2
In Visual Studio 2013 one way to cause this behaviour is to set build configuration to Release
.
Put it back to Debug
and see if that helps.
在Visual Studio 2013中,导致此行为的一种方法是将构建配置设置为Release。把它放回Debug,看看是否有帮助。
#1
7
One thing to check for is that your supporting project assembly has not been installed in the GAC. Open a command prompt and run the following to make sure...
要检查的一件事是您的支持项目组件尚未安装在GAC中。打开命令提示符并运行以下命令以确保...
gacutil /l assemblyName
gacutil / l assemblyName
#2
13
Not sure if this is it, but "Tools>Options>Debugging>General:Enable Just My Code" is a possibility. (I prefer to always leave this unchecked.)
不确定是不是这样,但“工具>选项>调试>常规:启用我的代码”是可能的。 (我更喜欢永远不加以控制。)
#3
13
It turns out that the assembly needed to be copied into the GAC before it could be debugged. Under the debugging option "Just my code", there's an option to suppress an error if you don't have any user code, and it was suppressing the following error:
事实证明,在调试之前,需要将程序集复制到GAC中。在调试选项“Just my code”下,如果您没有任何用户代码,可以选择禁止错误,并且它可以抑制以下错误:
The Following mobile was built either with optimizations enabled or without debug information. (Module name and path) To debug this module, change its build configuration to Debug mode.
以下移动设备是在启用优化或没有调试信息的情况下构建的。 (模块名称和路径)要调试此模块,请将其构建配置更改为调试模式。
Since I was building it in Debug configuration, I searched on that error message and got this:
由于我在Debug配置中构建它,我搜索了该错误消息并获得了:
Problem solved. I don't know why it needs to be in the GAC in order for me to step into the project, but it does. I don't ask why, I just ask how, and then I do it...
问题解决了。我不知道为什么它需要加入GAC才能让我进入项目,但确实如此。我不问为什么,我只问如何,然后我这样做......
#4
4
You need to ensure the supporting projects have pdb files or else Visual Studio will not have the necessary information to step through the code.
您需要确保支持项目具有pdb文件,否则Visual Studio将没有必要的信息来逐步执行代码。
#5
3
A couple of possibilities:
几种可能性:
-
There is a check box to step into "just my code". Its intent is to make it so you can't step into Microsoft's Framework code (unless you choose to by unchecking the box).
有一个复选框可以进入“只是我的代码”。它的目的是使它不能进入微软的框架代码(除非你选择通过取消选中框)。
-
You might try recompiling the supporting code to make sure the code you're debugging exactly matches the code file you're looking at. VS does care about this and will disable a breakpoint if you put it in the code file whose version doesn't match. Also, make sure the PDB file is in the same directory as the DLL.
您可以尝试重新编译支持代码,以确保您正在调试的代码与您正在查看的代码文件完全匹配。 VS确实关心这一点,如果你将断点放在版本不匹配的代码文件中,它将禁用断点。此外,请确保PDB文件与DLL位于同一目录中。
#6
2
If you have the source code for the dll's into which you are trying to step into, do the following:
如果您有要尝试进入的dll的源代码,请执行以下操作:
- Click on the project in which these dll's are added as reference and remove them.
- Add the Project(s) corresponding to the dll(s) to the solution
- Right click on the project -> Add Reference -> Choose the newly added Project(s).
单击添加了这些dll的项目作为参考并删除它们。
将对应于dll的项目添加到解决方案中
右键单击项目 - >添加引用 - >选择新添加的项目。
Now set the break point and debug the code.. You will be able to step into the code.
现在设置断点并调试代码..您将能够进入代码。
The reason for the issue is because you program is still referencing the old dll (without the source code) as it has been added to your project as a reference. Once you remove that dll and add the Project (Source code of the dll) of the dll, Visual studio will be able to step into your code.
问题的原因是因为您的程序仍然引用旧的dll(没有源代码),因为它已作为参考添加到您的项目中。删除该dll并添加dll的Project(dll的源代码)后,Visual Studio将能够进入您的代码。
#7
2
In Visual Studio 2013 one way to cause this behaviour is to set build configuration to Release
.
Put it back to Debug
and see if that helps.
在Visual Studio 2013中,导致此行为的一种方法是将构建配置设置为Release。把它放回Debug,看看是否有帮助。