Search code examples
c#debuggingasp-classiccom

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


Solution

  • 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.