Results 1 to 9 of 9

Thread: Obscure App builder crash

  1. #1
    Senior Member
    Join Date
    Apr 2014
    Posts
    201

    Obscure App builder crash

    Hi,

    Don't ask how I found this out because it was a really long process . Just put this code in a page's prg and click the button and the app builder crashes (the database must exist).

    The problem appears to be the '&sql' executing inside a try block, if this happens and then an error is generated afterwards, the crash occurs.
    Changing various elements of the code causes the problem not to occur, this was the only combination where I could get it to happen reliably.

    Code:
    ////////////////////////////////////////////////////////////////
    // Event delegate for 'click' event
    proc page1_section2_field2_click()
    
    	dbName = "mydb"
    	if ExecuteCommand1('open database &dbName')		
    		
    		private tab[]			
    		tab._name = "a"
    		//This will raise an error
    		if tab.name = "a"
    		endif		
    		
    	endif	
    	
    endproc
    
    
    function ExecuteCommand1(sql)
    
    	try		
    		&sql
    		return .T.
    	catch to e
    		return .F.		
    	endtry
    	
    endfunc

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Posts
    201
    Hi,

    This has turned into quite a big problem for me because I have quite a long routine that loops through lots of data, if my code hits any error then the ide crashes and I am certain it is related to the issue above. There is too much data for me to step through manually and if I just let it run then the ide crashes and I don't know what code is running at the time of the crash.

  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Before going further, is it typo?

    Code:
    tab._name = "a"
    if tab.name
    I mean: tab.name and tab._name

  4. #4
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,840
    Hi Alia,

    Put the return statements outside the try/endtry block:

    Code:
    function ExecuteCommand1(sql)
    
            try
                    &sql
                    // ? "Tried"
                    lreturn  = .T.
            catch to e
            	// ? "Caught"
                    lreturn  = .F.
            endtry
    		return lreturn
    endfunc
    Can you also Submit a Ticket for this.

    Thanks,

    Yvonne

  5. #5
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Also, instead of:

    Code:
    dbName = "southwind"
    if ExecuteCommand1('open database &dbName')
    I would try

    Code:
    dbName = "southwind"
    mycommand='open database '+dbName
    ?mycommand // so you can inspect 
    if ExecuteCommand1(mycommand)
    Last edited by josipradnik; 2016-01-26 at 07:10.

  6. #6
    Senior Member
    Join Date
    Apr 2014
    Posts
    201
    No, I purposely left that typo in so an error will be raised that will cause the ide crash.

  7. #7
    Senior Member
    Join Date
    Apr 2014
    Posts
    201
    This works Yvonne, thanks I will log a ticket

    Quote Originally Posted by yvonne.milne View Post
    Hi Alia,

    Put the return statements outside the try/endtry block:

    Code:
    function ExecuteCommand1(sql)
    
            try
                    &sql
                    // ? "Tried"
                    lreturn  = .T.
            catch to e
            	// ? "Caught"
                    lreturn  = .F.
            endtry
    		return lreturn
    endfunc
    Can you also Submit a Ticket for this.

    Thanks,

    Yvonne

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,184
    FWIW: in VFP a RETURN is also not allowed inside a TRY block or a CATCH block. I think it is in the FINALLY block. Basically, if you are going somewhere else, you have to get out of the try/catch first.

    Hank

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,161
    Blog Entries
    22
    The use of RETURN in a TRY/CATCH block is not legal in Lianja/VFP.

    I have corrected this behavior in v2.1Beta2 and reported an error when it is used incorrectly.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us