Whenever fox behaves remarkebly unexpected, I first add logging to places I had expected to code to touch and soon afterwards replace "with" references with actual local variables, as in very few scenarios there are errors inside the vfp engine caused by "with" - not often enough to overcome typing lazyness, but when you run into it it costs time - the same code with local vars works, with "with-references" fails.
>I caught that one later, as well as another bug with RemoveObject.
>
>I'm having the thought that because the error is actually happening inside RemoveObject (object not found) it is outside the scope of TRY/CATCH and goes right to the form error handler.
>
>>Not sure why the on error is firing, but the problem is deeper (and in this case your issue with it is moot), your code will never work as you are expecting, you will enter an infinite loop as the EXIT will exit the try catch block, not the DO WHILE as you are thinking, if you do not believe me or the help (look for EXIT COMMAND: "Exits a DO WHILE, FOR, SCAN, or
TRY…CATCH…FINALLY structure.") then try this simple program:
>>
>>
>>set escape on
>>do while .t.
>> try
>> abc
>> catch to loException
>> ? loException.Message
>> exit
>> ? 'I am never printed'
>> endtry
>>enddo
>>
>>
>>Enjoy infinity :)