Debugging COM Server...  
Author Message
Michael S.

PostPosted: Visual FoxPro General, Debugging COM Server... Top


I have a problem triggering a breakpoint in my VFP9 generated COM Server.

I have built a COM server class having several different public methods. And I have built a client app in C++ which over automation instantiate an object of my server class and calls one of the methods.

I'm using the de**** in Visual Studio 2005 to debug my C++ client application to the point where my automation method is called over COM.

What I like now, is the ability to debug the VFP com server method as well. I would like a breakpoint to trigger in the method, so that I can watch variables etc. and in general debug my VFP code.

How can I start Visual Studio and/or VFP so that I can trigger breakpoints in my VFP code

In general I had envisioned the following two possible scenarios, but I'm not able to make it work...

  1. Start VFP and "run" the COM Server. This should also startup the client application (which has to be specified somewhere). The client application which could be a VB, VC++ or C# application could potentially be started within the Visual Studio environment (or at least later be attached to the client process) so that the client code also can be debugged). You can then set break points using the VFP de**** and when the client calls your procedure/function it breaks and eureka all your variables can be watched and you can step nice and easily through your COM server code.
  2. Start the Visual Studio environment with your client application (again VB, VC++ or a C# application a possibility). Start the debugging inside Visual Studio. Somehow you should be able to see the VFP code and be able to set breakpoints in your procedures/functions. Whether you manually have to open VFP and the right project files or whether Visual Studio will be able to debug into it is up to the implementation. Likely it needs to do some clever process interaction, just in the same manner as Visual Studio can debug directly into .dll's.

Under all circumstances this would make a boost in productivity of debugging VFP
COM Servers.

Any ideas for triggering breakpoints in my VFP Com Server code

Thanks in advance for any replies.

Visual FoxPro1  
Craig Berntson

PostPosted: Visual FoxPro General, Debugging COM Server... Top

VFP cannot debug COM servers. You'll have to do it with the VS de****, which means you won't get the source code.

David Frankenbach

PostPosted: Visual FoxPro General, Debugging COM Server... Top


Trying to debug VFP COM, especially from another language, is quite painful. In the end you are stuck with logging output to a file that you can examine.

I break my VFP COM debugging into 3 parts: 1) instantiating the object as a plain VFP object where you have the full native debugging features available. 2) instantiating the object as COM from inside VFP and observing the output file. 3) Then observing the output file from the ultimate consumer language.

The class tree from which all my COM objects are derived from a class that has these debug output methods built in. I use an assign method on a couple of the properties that according to settings of flags and other properties appends a timestamp and the property value to the output file. This ends up being pretty handy because if a website all of the sudden starts having problems we can turn the debug flags on easily to see if the error is in the COM or the client code.

When dealing with interlanguage calls like you are one thing to do is dump the value that VFP is getting as parameters to the methods out, because a lot of times there end up being differences between what is sent and what you are expecting to get.