如何调试来自本机代码的 AccessViolationException
我正在编写托管代码,并且正在将托管绑定(qt4dotnet)用于非托管库(Qt)。有时,我会从 Qt 的某个地方收到 AccessViolationException,但我不知道如何调试它。我什至没有得到比托管/非托管边界更远的堆栈跟踪(这意味着我不知道 Qt 的哪一部分在我身上崩溃了)。
顺便说一句,我正在 VS 调试器中运行我的应用程序。
如何调试异常?
I'm writing managed code, and I'm using managed bindings (qt4dotnet) for an unmanaged library (Qt). Now and then, I get an AccessViolationException coming somewhere from Qt, but I don't know how to debug that. I don't even get a stacktrace further than the managed/unmanaged boundary (meaning I don't know what part of Qt crashed on me).
By the way, I'm running my app inside the VS debugger.
How do I debug the exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

项目+属性,调试选项卡,勾选“启用非托管代码调试”。这仍然不会让事情变得容易,但至少你可以在它爆炸时查看非托管堆栈帧。确保您已获得 Qt 代码的 .pdb 文件。
Project + Properties, Debug tab, tick "Enable unmanaged code debugging". This still won't make it easy, but at least you can look at the unmanaged stack frames when it bombs. Make sure you've got the .pdb files for the Qt code.