I just submitted this bug to Microsoft (as per instructions at ) and I thought that everyone may benefit from knowing about this odd behavior:
This is a Visual FoxPro bug about
FoxPro Version: 9.0 No SP
Reproduces: always
Steps to Reproduce:
(1) Open VFP
(2) Create a procedure file "TestOexc.prg" containing the following code:
(3) Run the procedure
Observed Behavior:
First, a dialog saying "TestOexc Caught User Thrown Error . Expected 1"
Second, a dialog saying "NOT EXPECTED: TestOexc Outer TRY Caught Alias 'OEXC' is not found."
Expected Behavior:
First, a dialog saying "TestOexc Caught User Thrown Error . Expected 1"
Second, a dialog saying "ErrProc Caught User Thrown Error . Expected 2"
Additional Information:
Even though ErrProc has the statement "PRIVATE oExc", the "TRY..CATCH TO oExc" phrase that should be creating a new, private oExc variable instead seems to be accessing the hidden, original oExc variable.
If the "PRIVATE oExc" statement is removed, it works correctly (though, I expect that then that the private oExc variable that already exists gets changed, when I'd prefer it not be changed.)
If the "PRIVATE oExc" statement is changed to "LOCAL oExc", then it all works correctly. (though, then, I expect that oExc behaves as a Local, and won't be visible in called functions like a Private var would)
- Bill
Get the best answers to your questions -- See FAQ481-4875.
This is a Visual FoxPro bug about
FoxPro Version: 9.0 No SP
Reproduces: always
Steps to Reproduce:
(1) Open VFP
(2) Create a procedure file "TestOexc.prg" containing the following code:
Code:
TRY
TRY
THROW "Expected 1"
CATCH TO oExc
MESSAGEBOX('TestOexc Caught '+oExc.Message+' '+TRANSFORM(oExc.UserValue) )
cMsg = oExc.message
DO ErrProc WITH cMsg
ENDTRY
CATCH TO oExc
MESSAGEBOX('NOT EXPECTED: TestOexc Outer TRY Caught '+oExc.Message+' '+TRANSFORM(oExc.UserValue) )
ENDTRY
PROCEDURE ErrProc( cMsg )
PRIVATE oExc
TRY
THROW "Expected 2"
CATCH TO oExc
MESSAGEBOX('Errproc Caught '+oExc.Message+' '+TRANSFORM(oExc.UserValue) )
ENDTRY
ENDPROC
(3) Run the procedure
Observed Behavior:
First, a dialog saying "TestOexc Caught User Thrown Error . Expected 1"
Second, a dialog saying "NOT EXPECTED: TestOexc Outer TRY Caught Alias 'OEXC' is not found."
Expected Behavior:
First, a dialog saying "TestOexc Caught User Thrown Error . Expected 1"
Second, a dialog saying "ErrProc Caught User Thrown Error . Expected 2"
Additional Information:
Even though ErrProc has the statement "PRIVATE oExc", the "TRY..CATCH TO oExc" phrase that should be creating a new, private oExc variable instead seems to be accessing the hidden, original oExc variable.
If the "PRIVATE oExc" statement is removed, it works correctly (though, I expect that then that the private oExc variable that already exists gets changed, when I'd prefer it not be changed.)
If the "PRIVATE oExc" statement is changed to "LOCAL oExc", then it all works correctly. (though, then, I expect that oExc behaves as a Local, and won't be visible in called functions like a Private var would)
- Bill
Get the best answers to your questions -- See FAQ481-4875.