Precompiling Issues with XojoScript

I have discovered a strange issue with precompiling XojoScripts. Take for example the sample Scriptimaging project in the Imaging folder inside Example Projects:Advanced:XojoScript. Go to the RunButton Action code and add the following line above the code section shown.

optimizeOK = ImageScript.Precompile(XojoScript.OptimizationLevels.None) // add this line

If optimizeCheck.Value Then
optimizeOK = ImageScript.Precompile(XojoScript.OptimizationLevels.High)
Else
optimizeOK = ImageScript.Precompile(XojoScript.OptimizationLevels.None)
End If

Now, a second precompile regardless of optimization level will fail to replace the code with optimized code. The end result is that if another precompile is done, the code that is generated is either ignored or trashed. You can verify this behavior by checking the optimize button on the buddhabrot preset. The result is identical to no optimization whether this button is checked or not.

I discovered this problem because my program always does a precompile with no optimization first to check for errors, and then does a higher optimization if no errors are found. This approach used to work with RBScript. It does not work with the new XojoScript.

Is there a workaround? Is there a way to throw out a previous precompile and start from scratch? Is this something I should report via Feedback, or is this expected behavior.

File a bug report.

37407 - XojoScript precompiles fail to update the code by using the most recent precompile.

Thanks Joe

Try reassigning the source before precompiling again, that works for me in an older Xojo.