I still get this occasionally, it is annoying and can be hard to track down.
The last one was traced to using an undeclared variable in a modula division - I had changed the variable name in one place and not another. Silly mistake.
I have seen the comments about project size being the cause, but have not found this to be the case. I would suggest that larger projects simply provide more chance of the error occurring without the size being the actual cause.
As Grumpy Jedi points out, some people seem to have resolved this by adding random lines of code, but to me this seems like groping in the dark rather than debugging.
Unless you find the source of the error, you run the risk of releasing a bugged application and adding random code might make the pain go away, but it is not really addressing the problem.
Quote: "I'm going to start playing around with the code and removing some segments to see if I can narrow down the source of the issue"
This is the best approach, generous commenting out of lines - particularly in newly added code - to narrow it down to the statement causing the issue. Then dumping variable contents to a file before and after each statement will show how variables are changing.
This is the kind of function used to dump details to a file;
function DebugWrite( thisString$ )
thisFile = openToWrite( "debug.txt" , 1 )
writeLine( thisFile , thisString$ )
closeFile( thisFile )
endfunction
In the code you would have something like
DebugWrite( "Calling function ABC() with " + str( thisValue) )
thisResult = ABC( thisValue )
DebugWrite( "Result from function ABC() = " + str( thisResult) )
Which shows the variables going into and coming out of a function.
Common causes for me have been;
- Functions not receiving parameters correctly
- Functions not returning variables correctly
- Access to strings stored in UDT fields
- Accessing undefined variables
I hope you find the cause, Best of luck.