“Stack underflow” error only in Release mode.

Today i came across a very weird error, that showed, only in release mode:

VerifyError: Error #1024: Stack underflow occurred.

Apparently, after googling the web, it happens (one of the many reasons…) when the compiler compiles by error a trace statement. 

In general, trace() calls get ignored in release mode, but if they appear in the code in non conventional ways, they can enter the swf file and trigger that error.

In my case, i was tracing something if some condition was true, but i wrote it this way: 

some_variable && trace(“variable is true”);

apparently that was the error making the trace enter the published swf bytecode. 

My solution was to remove that line and i wont be using that type of tracing anymore. 

More usefull info about this subject here: