Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execscript() Crashing Build -- Bug?
Message
From
06/12/2006 14:22:18
Spencer Redfield
Managed Healthcare Northwest, Inc.
Portland, Oregon, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Project manager
Title:
Execscript() Crashing Build -- Bug?
Miscellaneous
Thread ID:
01175348
Message ID:
01175348
Views:
64
I stumbled upon an unexpected problem found in both VFP 8 SP1 and 9 SP1.

Background: I added additional lines to our original EXECSCRIPT() parameter and, from the command window, the changes ran fine. (This EXECSCRIPT() parameter string is legal.)

However, whenever I attempted to compile the project it quickly crashed with the dreaded C000005 error. The identical behavior occurs on my manager's machine. Changing the FOXUSER resource file, my first guess, makes no difference.

A workaround is to add the parameter value indirectly via a variable. Is this a bug or is this behavior documented? Simple repro code follows:
#IF ( .T. )
    * This builds just fine
    lcOnF3Script =  ;
        "local lcTagName"       + chr(13) + chr(10) + ;
        "local lnTagHit"        + chr(13) + chr(10) + ;
        "gcHowExited='F3'"      + chr(13) + chr(10) + ;
        "select 'AltProvFacil'" + chr(13) + chr(10) + ;
        "ATagInfo(laTheTags,'AltProvFacil')"    + chr(13) + chr(10) + ;
        "lnTagHit = ascan( laTheTags, 'SSN', -1, -1, 1, 15 )"  + chr(13) + chr(10) + ;    
        "if ( empty( m.lnTagHit ) )"                           + chr(13) + chr(10) + ;
        "    lnTagHit=ascan( laTheTags, 'TIN', -1, -1, 1, 15 )"+ chr(13) + chr(10) + ;
        "endif"    + chr(13) + chr(10) + ;
        "lcTagName=laTheTags[ m.lnTagHit, 1 ]"    + chr(13) + chr(10) + ;
        "lcTagName=iif(order()=='DISPLORDER', m.lcTagName, 'DisplOrder' )" ;
            + chr(13) + chr(10) + ;
        "set order to (m.lcTagName)"    + chr(13) + chr(10) + ;
         "KEYBOARD '{Esc}' plain"
    * Inserting the parameter text using a varialble
    on key label "F3"    execscript( m.lcOnF3Script )
#ELSE
    * This crashes a build under both VFP 8 SP1 and VFP 9 SP1
    *
    * Inserting the same text directly causes a C0000005 error when 
    * the project is built and yields no clue as to the cause! 
    *
    * (Note: In a .PRG run from the command line the following 
    * will run without problem -- until a build is attempted.)
    *
    on key label "F3" execscript( ;
        "local lcTagName" + chr(13) + chr(10) + ;
        "local lnTagHit"        + chr(13) + chr(10) + ;
        "gcHowExited='F3'"      + chr(13) + chr(10) + ;
        "select 'AltProvFacil'" + chr(13) + chr(10) + ;
        "ATagInfo(laTheTags,'AltProvFacil')"    + chr(13) + chr(10) + ;
        "lnTagHit = ascan( laTheTags, 'SSN', -1, -1, 1, 15 )"  + chr(13) + chr(10) + ;    
        "if ( empty( m.lnTagHit ) )"                           + chr(13) + chr(10) + ;
        "lnTagHit=ascan( laTheTags, 'TIN', -1, -1, 1, 15 )"    + chr(13) + chr(10) + ;
        "endif"    + chr(13) + chr(10) + ;
        "lcTagName=laTheTags[ m.lnTagHit, 1 ]"    + chr(13) + chr(10) + ;
        "lcTagName=iif(order()=='DISPLORDER', m.lcTagName, 'DisplOrder' )"    ;
            + chr(13) + chr(10) + ;
        "set order to (m.lcTagName)" + chr(13) + chr(10) + ;
         "KEYBOARD '{Esc}' plain"     )
#ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform