Home » Uncategorized » VFP and heart stoppage
Jun
19

VFP and heart stoppage

I can probably count on both hands and feet the number of times I have literally sworn at Visual FoxPro (that would make it an average of once a year). Today was one of those days. I have been working on a new solution for one of my customers that needs to send email. I have tried several techniques with emailing from FoxPro over the years (Outlook Automation, CDO, West Wind wwIPStuff, Shelling out a MailTo, and most recently Craig Boyd’s Extended MAPI FLL, and Blat). The swearing has nothing to do with any of the email techniques, but I can say working with email does cause hair loss.

The situation that caused me to swear today was one I have never seen before, and honestly cannot explain how it happened. I was working with a set of classes. One parent class (abstract) and four different subclasses with all the different implementation scenarios. I was using the Class Browser to work with the class library. I instantiated the child class like normal using a NEWOBJECT(), and then called the SelfTest method I have setup to run through different test scenarios I have to verify the code works as designed. I found the problem I was tracking down in the debugger, canceled out, and opened up the subclass.

This is when the twilight zone moment happened. When I opened the class all the source code for the class was gone. I mean gone, as in zero property settings, and no method code. I closed the class and opened it again. Same thing. Holy S&^*&&*t! (sorry, but I have to tell the whole story). A complete morning’s worth of stream of conscious coding out the window. I tried to open up the parent class and got the message that the class was in use. Weird.

CLOSE ALL
CLEAR ALL
RELEASE ALL
CLEAR PROGRAM
ox=.NULL.
RELEASE ALL
*{pray}

Yes, I know the commands have some redundancy, but one can never be to sure to get the cleanest environment. Back to the Class Browser and still no luck opening the parent class: still in use. Visual FoxPro has a way to hold on to classes when I least want it to. Time for the FoxPro flush (not the FLUSH command, rather, QUIT and restart). Opened up the Class Browser and my subclass and there it is in all it’s glory, the source code for methods and properties are back to normal. Relief.

So I backed up the class library and finished up the documentation in the classes and called it a morning. Hopefully the stress of potentially losing the source code made me stronger since it did not kill me (this time at least).

5 Responses to “VFP and heart stoppage”

  1. June 20th, 2008 at 00:52 | #1

    What a great opportunity to go to the system datasession to close the VCXes manually. *bg*

    Your list misses one command: CANCEL. If VFP is for some reason just in suspended mode, CLEAR ALL and RELEASE ALL won’t clear those classes that are in the calling stack.

  2. Jamie Osborn
    June 20th, 2008 at 01:02 | #2

    It’s happened to me a few times like that.

    It’s also happened where the code IS gone or even worse – the vcx and vct are DELETED and when I bring them back, the method I was working on is gone.

    It seems to happen when I have a mthod open and then go into the class menu and delete that method but I can’t reproduce it.

  3. June 20th, 2008 at 09:03 | #3

    Good point Christof, especially since I was in “double insurance” mode with the other commands. I did use the cancel button in the debugger, but definitely should have CANCELed from the Command Window.

  4. June 20th, 2008 at 09:07 | #4

    Jamie, thanks for reminding me that it could have been worse {g}. I am pretty sure this is something very difficult to reproduce and something I never want to see again.

  5. June 20th, 2008 at 12:17 | #5

    Rick,

    Dude, this is a bit scary. It almost makes you want to use source control. ;)

    BOb

Add reply