在VS2010中调试COM dll

发布于 2024-11-30 19:22:41 字数 361 浏览 1 评论 0原文

我有一个 ASP.NET WebApplication (.NET 4.0/C#),它与外部 COM dll(用 C++ 编写)配合使用。

在一个与旧的 ASP 项目完美配合的函数调用中,我在 DLL 代码中收到 AccessViolationException。

为了调试它,我向编写该 DLL 的同事请求了该 DLL 的调试版本。但我无法直接访问 dll 项目或源代码。

如何使用这个调试dll来找出错误发生的位置?我找不到进入我正在调用的方法的方法。是否可以?

编辑:我也有 .pdb 文件,如果有的话。由于某种原因,我在“调试”->“Windows”->“模块”概述中看不到 COM dll。我真的很困惑,非常感谢任何帮助。

I have an ASP.NET WebApplication (.NET 4.0/C#) that works with an external COM dll (written in C++).

On a function call, which worked perfectly with an older ASP project, I get a AccessViolationException in the DLL code.

To debug it, I requested a debug version of the DLL from my colleague who wrote it. I have no access to the dll project or source code directly though.

How can I use this debug dll to find out where the error is occuring? I could not find a way to step into the method I am calling. Is it possible?

EDIT: I have the .pdb file as well, if that's any good. For some reason I cannot see the COM dll in the Debug->Windows->Modules overview. I'm really stuck, any help appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

极致的悲 2024-12-07 19:22:41

您需要启用非托管代码调试

来自 MSDN

项目设计器的“调试”页面上提供的非托管代码调试属性确定是否支持本机代码的调试。如果您要调用 COM 对象,或者启动用本机代码编写的自定义程序调用您的项目并且需要调试本机代码,请选择此选项。

对于 ASP,您需要在 Web 选项卡的“调试器”部分中选中“本机代码”。

此外,您还应该在调试选项中禁用仅我的代码调试

You need to have Unmanaged Code Debugging enabled.

From MSDN:

The Unmanaged code debugging property, available on the Debug page of the Project Designer, determines whether debugging of native code is supported. Select this option if you are making calls to COM objects, or if you start a custom program written in native code that calls your project and you need to debug the native code.

For ASP, you need to check 'Native Code' in the Debuggers section of the Web tab.

Also you should have Just My Code debugging disabled in the debugging options.

千紇 2024-12-07 19:22:41

也许您可以使用 Ildasm.exe 来破解 dll 以查看丢失的内容。至于违规问题,听起来似乎与这个问题类似。尝试从此 SO 进行静态导入。 MsCorlib.dll 可能与第三方 dll 存在问题。

非托管 DLL 导致 AccessViolationException

请注意依赖关系,并且您可能会遇到一些封送问题。我建议在控制台应用程序中使用 DllImport 来查看它是否可以解决。祝你好运!

Perhaps you could use Ildasm.exe to rip through the dll to see what you are missing. As for violations it sounds as if it is similar to this issue. Try a static import from this SO. MsCorlib.dll may be having an issue with the third party dll.

Unmanaged DLL causing AccessViolationException

Be aware of the dependencies and that you may have some marshaling issues. I advise using DllImport in a console app to see if it can resolve. Best of lucK!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文