user9073369
user9073369

Reputation:

How to debug and step into a COM object

I have a classic ASP website running on IIS. The site uses some COM objects (via VBScript CreateObject), which actually are .DLL's written in C#. So the question is how can I debug the C# code in Visual Studio 2017?

I tried to attach to a process w3wp.exe, but it does not show any DLL's, just script code: enter image description here

My PDB files are placed in the same folder as the DLL's and I also unchecked "Just my code", but nothing helps. Since no dlls loaded, no symbols loaded my breakpoints do not hit

Upvotes: 2

Views: 1545

Answers (2)

Abhinaw Kaushik
Abhinaw Kaushik

Reputation: 627

Did you tried attaching the w3wp.exe in your C# application? you can open that C# application and make sure that outout of that application is the DLL which is referenced there and put breakpoint on the method which you want to debug, while attaching the debugger, the output window itself can tell you whether the right symbols are loaded or not, if it says symbols are loaded then breakpoint will hit.

Give it a try it should work as i've faced this previously.

Upvotes: 0

user692942
user692942

Reputation: 16680

If you are attaching the debugger to a Classic ASP Web Application you need to make sure that you tell it that you want to debug managed code as well.

  1. In the Attach to Process window before selecting the process to attach to, locate the Select... option to the right of the Attach to: label;

    Attach to Process Window

    This will open the Select Code Type window where you can select the code type debuggers to attach.

  2. Select multiple code types from those listed, specifically the Managed version of .Net that fits the compilation of the .Net COM DLL you wish to debug.

    Select Code Type Window

  3. Attach to the process as normal.

Upvotes: 2

Related Questions