Visual Studio 2010 中的设计时调试
我在 Visual Studio 2010 Pro 中进行设计时调试时遇到以下问题。
在我的解决方案中,我有两个库。一个名为 Alfa 的包含我的一些基本组件。两个名称为 AlfaDesign,它包含来自 Alfa 库的组件设计器。当然,我有一个开发和测试 Alfa 组件的项目。
AlfaDesign 参考了 Alfa 库。测试项目参考了Alfa和AlfaDesign。
我的问题是:
当我在 Alfa 库的组件构造函数中放置断点,然后将该组件放置在测试项目的表单上时,调试器不会中断。 Visual Studio 仍在运行。
我按照教程演练:在设计时调试自定义 Windows 窗体控件中的说明进行操作,但没有任何成功。
I have the following problem with design-time debugging in Visual Studio 2010 Pro.
In my solution I have got two libraries. One with name Alfa that contains some of my basic components. Two with name AlfaDesign that it contains designers for components from library Alfa. And of course I have a project for developing and testing Alfa components.
AlfaDesign is having reference to Alfa library. And the test project is having a reference to Alfa and AlfaDesign.
And my problem:
When I put breakpoint in component's constructor from the Alfa library and then I put this component on the form in my testing project, the debbuger is doesn't break. Visual Studio is still running.
I followed instruction from the tutorial Walkthrough: Debugging Custom Windows Forms Controls at Design Time, but without any success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
今天我在一个项目中遇到了这个问题,我花了最后几个小时来解决它。我发现,在进行 F5 调试时,当项目目标框架设置为小于 .NET 4 的值时,符号和模块将不会加载。将项目切换到 .NET 4 确实可以修复这种奇怪的行为,但您可能不希望将其用于您不想使用较新运行时的 .NET 2 应用程序/BCL。
但是,您仍然可以纠正此行为。您可以使用 Debug -> 手动运行附加到进程并选择 devenv.exe,这将加载模块和符号。因此,您可以打开 Visual Studio 2010 的第二个实例并简单地附加,也可以在调试(运行外部程序)、分离和重新附加时运行它以加载模块。
我认为这是我的环境设置有问题,因为我安装的 Visual Studio 是非常自定义的,所以我认为可能存在某种设置、冲突或文件差异,但这似乎只是Visual Studio 2010 调试器。我很想知道 Visual Studio 2010 团队中的任何人是否可以对此进行进一步调查。
I ran into this problem today with one of my projects, and I spent the last several hours figuring it out. What I found is that the symbols and modules will not load when your project target framework is set to anything less than .NET 4 when doing an F5 debug. Switching the projects to .NET 4 does fix this weird behavior, but you may not want this for .NET 2 applications that you don't want to use the newer runtimes/BCL.
However, you can still correct this behavior. You can run manually use Debug -> Attach To Process and select devenv.exe and that will load the modules and symbols. So, you can either have a second instance of Visual Studio 2010 already open and simply attach, or you can run it on debug (Run External Program), Detach, and Re-attach to get the modules to load.
I thought this was something wrong with my environment settings, because my install of Visual Studio is very customized, so I thought there might have been some sort of setting, conflict, or file difference, but it seems to just be a weird behavior in the Visual Studio 2010 debugger. I would be curious to see if anyone from the Visual Studio 2010 team could investigate this a bit further.
如果断点被正确解决,那么它一定会正确命中。
请检查以下内容。
断点是否正确解析。如果正确解决,它将在调试会话期间显示为红色。否则红色将变成禁用状态(带有黄色感叹号和灰色圆圈)。
If the breakpoints are properly resolved, then it must hit properly.
Please check the following.
Is the breakpoint resolved properly or not. If it's properly resolved, it will be displayed in red during debugging sessions. Otherwise the red will turn into a disabled state (with a yellow exclamation mark with a grayed circle).