为什么VS2008中的断点会停止工作?

时间:2022-11-09 02:50:34

I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening?

我有一个c#asp.net网络应用程序。数据库层中的断点不再停止执行,但UI层中的断点仍然可以正常工作。任何人都可以猜测为什么会发生这种情况?

I've checked all the usual suspects (Debug build is on for all projects) and recompiled all projects in solution...

我检查了所有常见的嫌疑人(所有项目的Debug构建都已开启)并重新编译解决方案中的所有项目...

6 个解决方案

#1


1  

I would ensure that the UI layer is referencing the appropriate 'debug' .dll's. I'd also consider pressing CTRL+ALT+U (Modules View) when you're debugging to see if symbols are loaded for your BLL and DAL .dlls. If not then Visual Studio is unable to find .PDBs for that file. Are debug files (.PDBs) in the same directory as the .dlls that are being referenced from the Modules window?

我会确保UI层引用适当的'debug'.dll。我还考虑在调试时按CTRL + ALT + U(模块视图)以查看是否为BLL和DAL .dll加载了符号。如果没有,则Visual Studio无法找到该文件的.PDB。调试文件(.PDBs)与从模块窗口引用的.dll在同一目录中吗?

#2


1  

  • Attach the debugger to ASP.NET process and click on the modules window. Ensure that debugging symbols are loaded for the assemblies you want to debug.
  • 将调试器附加到ASP.NET进程,然后单击模块窗口。确保为要调试的程序集加载调试符号。

  • Make sure the UI is referencing the debug assemblies, not release assemblies.
  • 确保UI引用调试程序集,而不是发布程序集。

  • Make sure the .PDB files are in the /bin/debug/ directory
  • 确保.PDB文件位于/ bin / debug /目录中

  • Make sure you rebuild the entire solution before attaching the debugger.
  • 确保在连接调试器之前重建整个解决方案。

  • If the data tier is in a seperate solution, add the project to the UI SLN (You don't need to add a reference, those should already be established or your code wouldn't compile), so that the debugger can pull up the full code.
  • 如果数据层处于单独的解决方案中,请将项目添加到UI SLN(您不需要添加引用,那些应该已经建立或者您的代码无法编译),以便调试器可以启动完整的代码。

#3


1  

Thanks for the responses and ideas guys - I had already tried all of those or variations of them.

感谢您的回复和想法 - 我已经尝试了所有这些或变体。

I think that it must be a very subtle VS bug. A colleague suggested I make the function that I was trying to break on public (previously "undefined" so was implicitly private) and try again. I did this and the breakpoint started to get hit. I then removed the public keyword and the breakpoint continued to be hit. No idea why this solved it but it did.

我认为它必须是一个非常微妙的VS bug。一位同事建议我做一个我试图在公共场合打破的功能(之前是“未定义”,因此是隐式私人的),然后再试一次。我这样做了,断点开始受到打击。然后我删除了public关键字,断点继续被击中。不知道为什么这解决了它,但确实如此。

Thanks for you help!

谢谢你的帮助!

#4


1  

A couple of suggestions. The first one is to check the status of the breakpoint in the source line. Is it a solid red ball? If not, it generally indicates that the file in question isn't the one used for the build. Secondly - have a look at the modules view and see what module and symbols have been loaded. You may find it's not what you expect.

一些建议。第一个是检查源代码行中断点的状态。这是一个坚实的红球吗?如果不是,则通常表示有问题的文件不是用于构建的文件。其次 - 查看模块视图,查看已加载的模块和符号。你可能会发现它不是你所期望的。

As for why - I've no idea!

至于为什么 - 我不知道!

Nick

#5


0  

Have you tried deleting your bin directories before recompiling?

您是否尝试在重新编译之前删除bin目录?

#6


0  

I had the same issue and kept thinking "what did I change in web.config" to potentially do this?

我有同样的问题,并一直在想“我在web.config中做了什么改变”​​才可能做到这一点?

  <location path="." inheritInChildApplications="false">

That was not allowing breakpoints to work for me.

这不允许断点为我工作。

#1


1  

I would ensure that the UI layer is referencing the appropriate 'debug' .dll's. I'd also consider pressing CTRL+ALT+U (Modules View) when you're debugging to see if symbols are loaded for your BLL and DAL .dlls. If not then Visual Studio is unable to find .PDBs for that file. Are debug files (.PDBs) in the same directory as the .dlls that are being referenced from the Modules window?

我会确保UI层引用适当的'debug'.dll。我还考虑在调试时按CTRL + ALT + U(模块视图)以查看是否为BLL和DAL .dll加载了符号。如果没有,则Visual Studio无法找到该文件的.PDB。调试文件(.PDBs)与从模块窗口引用的.dll在同一目录中吗?

#2


1  

  • Attach the debugger to ASP.NET process and click on the modules window. Ensure that debugging symbols are loaded for the assemblies you want to debug.
  • 将调试器附加到ASP.NET进程,然后单击模块窗口。确保为要调试的程序集加载调试符号。

  • Make sure the UI is referencing the debug assemblies, not release assemblies.
  • 确保UI引用调试程序集,而不是发布程序集。

  • Make sure the .PDB files are in the /bin/debug/ directory
  • 确保.PDB文件位于/ bin / debug /目录中

  • Make sure you rebuild the entire solution before attaching the debugger.
  • 确保在连接调试器之前重建整个解决方案。

  • If the data tier is in a seperate solution, add the project to the UI SLN (You don't need to add a reference, those should already be established or your code wouldn't compile), so that the debugger can pull up the full code.
  • 如果数据层处于单独的解决方案中,请将项目添加到UI SLN(您不需要添加引用,那些应该已经建立或者您的代码无法编译),以便调试器可以启动完整的代码。

#3


1  

Thanks for the responses and ideas guys - I had already tried all of those or variations of them.

感谢您的回复和想法 - 我已经尝试了所有这些或变体。

I think that it must be a very subtle VS bug. A colleague suggested I make the function that I was trying to break on public (previously "undefined" so was implicitly private) and try again. I did this and the breakpoint started to get hit. I then removed the public keyword and the breakpoint continued to be hit. No idea why this solved it but it did.

我认为它必须是一个非常微妙的VS bug。一位同事建议我做一个我试图在公共场合打破的功能(之前是“未定义”,因此是隐式私人的),然后再试一次。我这样做了,断点开始受到打击。然后我删除了public关键字,断点继续被击中。不知道为什么这解决了它,但确实如此。

Thanks for you help!

谢谢你的帮助!

#4


1  

A couple of suggestions. The first one is to check the status of the breakpoint in the source line. Is it a solid red ball? If not, it generally indicates that the file in question isn't the one used for the build. Secondly - have a look at the modules view and see what module and symbols have been loaded. You may find it's not what you expect.

一些建议。第一个是检查源代码行中断点的状态。这是一个坚实的红球吗?如果不是,则通常表示有问题的文件不是用于构建的文件。其次 - 查看模块视图,查看已加载的模块和符号。你可能会发现它不是你所期望的。

As for why - I've no idea!

至于为什么 - 我不知道!

Nick

#5


0  

Have you tried deleting your bin directories before recompiling?

您是否尝试在重新编译之前删除bin目录?

#6


0  

I had the same issue and kept thinking "what did I change in web.config" to potentially do this?

我有同样的问题,并一直在想“我在web.config中做了什么改变”​​才可能做到这一点?

  <location path="." inheritInChildApplications="false">

That was not allowing breakpoints to work for me.

这不允许断点为我工作。