How to debug AccessViolationException coming from

2019-07-17 08:32发布

问题:

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?

回答1:

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.



回答2:

only by inspecting parameters given to a function that calls native code.