PDA

View Full Version : ByRef runtime error



wila
8-Jun-2018, 11:42 AM
Hi,

Sorry I could not reproduce it in a single .src file, so you'll get the whole CleanMarkers project.
Beware that this workspace is considered broken as I commented out the patch.

Please unzip and open the attached workspace.
Compile and run in DF19.1 alpha 2

Put a breakpoint in file Cleanmarkers.vw, line 902 on line:


Get RemoveComments (&sLine) to bRemoved


Then select the test file "oDummyObjectForTesting.pkg" and run the cleanup.

Run and check the value in sLine when you hit the breakpoint.
The value is: " If (Uppercase(Left(sLine, 13))="SEARCHING FOR") Begin"

Step into RemoveComments
Check the value of sLine again.

There is no value (???)

If I add a dummy line


Move sLine to sLine

above before calling the RemoveComments function it works OK.

It might also happen in earlier DataFlex versions, I haven't tested.
Frankly it doesn't matter, this should never be possible.

Especially as I cannot even reproduce when extracting those functions to a single .src test file.
--
Wil

wila
8-Jun-2018, 12:25 PM
FYI,

Got a question on why I would not change


Function LineEndHasBeginOrSemicolumn String sLine Returns Boolean

into


Function LineEndHasBeginOrSemicolumn String ByRef sLine Returns Boolean


Well if I do that then the ByRef issue no longer happens, but now the source code that is being processed will loose comments on all lines that start with an "if" or an "else", so it is on purpose that the function there is not using a ByRef variable.

--
Wil

Dennis Piccioni
8-Jun-2018, 03:30 PM
Hi Wil,

I reproduced this here and you are correct about the workaround. It looks like either both or neither method calls need to be byref. We are investigating.

Todd Forsberg
8-Jun-2018, 03:33 PM
It's that ol' DataFlex Black Magic (https://support.dataaccess.com/Forums/showthread.php?58882-DataFlex-Black-Magic!) again. :p