无法在 64 位操作系统上的 Visual Studio 中通过 catch 设置下一条语句
我们最近迁移到 64 位操作系统 (Windows 7) 并安装了 Visual Studio 2008。现在,在捕获异常后进行调试时,我无法将下一条语句设置回 try 块中的代码。我用谷歌搜索了这个并点击了这篇文章。
这解释了它,但这可以追溯到 2007 年。现在有任何解决方案或解决方法吗?
We recently moved to a 64 bit OS (Windows 7) and installed visual studio 2008. Now while debugging once an exception is caught, I am not able to set the next statement back to a code in the try block. I googled about this and hit with this article.
That explains it but This is dated back in 2007. Is there any solution or a work around now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.NET 使用 Windows 结构化异常处理的底层管道。 x64 异常处理的实现方式存在很大差异。它使用编译器生成的地址表来定位正确的异常过滤器。 x86 使用函数指针的链表,更容易由编译器实现。
更改 x64 方式的原因之一是出于安全原因,病毒代码通过修补链接列表并引发异常来设法注入自身,从而允许其有效负载执行。 XP SP1 中有针对这种情况的对策,但以效率为代价。 x64 的重新设计避免了这种成本。
好吧,你可以看到它的发展方向。无论如何,您应该将平台目标设置为 x86 来调试代码。这还启用了“编辑+继续”,这是一个非常有价值的调试辅助工具。这是 VS2010 项目的默认设置。仅针对发布版本切换到 AnyCPU。
.NET uses the underlying plumbing of Windows' structured exception handling. There's a Big Difference in the way x64 exception handling is implemented. It uses tables of addresses, generated by the compiler to locate the proper exception filter. x86 uses a linked list of function pointers, much easier to implement by a compiler.
One of the reasons the x64 way was changed was for security reasons, viral code managed to inject itself by patching the linked list and causing an exception, allowing its payload to execute. There were counter-measures against that in XP SP1, at a cost of efficiency. The x64 redesign avoids that cost.
Well, you can see where that's heading. You ought to debug code with the Platform Target set to x86 anyway. This also enables Edit + Continue, a very valuable debugging aid. It is the default setting for VS2010 projects. Only flip to AnyCPU for the Release build.
疯狂的答案:只在 catch 中放置对变量的赋值,并在其下面放置一个 if/process 。
Crazy answer: put only an assigment to variable in the catch and an if/process below it.