4

I wrote an ActiveX Control (OCX) in native C++ using VS2008.

I can debug it correctly when I attach to the thread of Microsoft ActiveX control test container (TstCon32.exe) and my own native cpp application which references the control.

However, I can't debug it by attaching it to the thread of a .NET winform application referencing the control by MyCtrlNameLib.dll and AxMyCtrlNameLib.dll. It shows the following message on my break points:

The breakpoint will not currently be hit. No symbols have been loaded for this document. message

I wonder if there is a way to debug my ActiveX Control referenced by a .NET Winform application.

I think the problem is my .NET application isn't load MyCtrlName.ocx, and therefore no MyCtrlName.pdb is added. It load InterOp.MyCtrlNameLib.dll and AxInterOp.MyCtrlNameLib.dll instead.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
SuperLucky
  • 595
  • 5
  • 15

2 Answers2

1

"I wonder if there is a way to debug my ActiveXControl referenced by a .NET Winfrom application"

No, it is not possible.

Why? Because ActiveX is a standalone component, that your C# application uses in its binary form. This .NET application has absolutely no information about the internal implementation of your ActiveX, it only knows its interface so that the functionality that this component provides can be used.

I can debug it correctly when I attach to the thread of Microsoft ActiveX control test container (TstCon32.exe) and my own native cpp application which references the control

Because the only way how you can debug the code of your ActiveX is by attaching to the process that actually executes this code.

LihO
  • 41,190
  • 11
  • 99
  • 167
  • Yeah, I see no MyCtrlName.ocx is in Debug Module windows, only AxInterOp.MyCtrlNameLib.dll and InterOp.MyCtrlName.dll is loaded. – SuperLucky Mar 14 '13 at 15:28
  • However, using explorerXp, MyWinApp.exe DOES load MyCtrlName.ocx. So I think the process actually execute it, but when you attach a process using managed code, VS just ignore those modules of non-managed code? Hm, I got some experiment to do. Thank you for your help anyway. – SuperLucky Mar 14 '13 at 15:40
1

Many thanks to @LihO point me a correct direction, I finally got it worked. The solution is really simple: Just go to property of my activeX control project. Under Debug branch, set "Debugger Type" to "Mixed" and all breakpoints can be hit.

SuperLucky
  • 595
  • 5
  • 15