1
votes

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.

2
Give it back to your colleague. Debugging heap corruption is not for the feint of heart, the .pdb doesn't actually help.Hans Passant

2 Answers

4
votes

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.

0
votes

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!