This project has moved. For the latest updates, please go here.

about script error

Mar 26, 2012 at 6:02 AM
Edited Mar 26, 2012 at 11:40 AM

Hi

I write a function like below:

function test() 
 {
	for (var i = 0; i < 6; i++) {
		if (i == 3) {
		   continue;
		}
	}
 }
when I execute, it throws exception
A first chance exception of type 'System.InvalidProgramException' occurred in JurassicWP71.dllparseScript Execption System.InvalidProgramException: InvalidProgramException   
at Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues)   
at eval()   
at Jurassic.Compiler.EvalMethodGenerator.Execute()   
at Jurassic.ScriptEngine.Evaluate(ScriptSource source)   
at Jurassic.ScriptEngine.Evaluate(String code)

Now I remove "var" in for loop
function test() 
 {
	for (i = 0; i < 6; i++) {
		if (i == 3) {
		   continue;
		}
	}
 }
It' ok.
It seems to be conficted by "var" and "continue"
How to solve this?
Thank you.
Coordinator
Mar 28, 2012 at 10:51 AM

Thanks for a very good minimal test case :-)

Yes, this is an issue in the currently released version (v2.1).  The conditions are almost exactly as you state - the bug occurs when you have a function with:

  • An integer local variable
  • A loop of some kind (in this case a for loop)
  • A continue or break statement inside the loop
  • No eval statement
  • No reference to "arguments"
  • No nested function

This bug is fixed in the latest source release - I recommend building from that if you can.

 

 

Mar 29, 2012 at 6:27 AM
Edited Mar 29, 2012 at 6:37 AM

Hi

I havd downloaded the latest version (jurassic_39608d99435c). The error still exists.

I check that when ' for loop' is in a function and I invoke the function, it throws exception.

when the 'for loop' is invoked directly, It's ok.

Coordinator
Mar 29, 2012 at 8:12 AM
Edited Mar 29, 2012 at 8:13 AM

Hmm, I was not able to reproduce the error on the latest release in my testing.  Can you provide all the code that you are using?  Also, what platform are you using (.NET 3.5/.NET 4/Silverlight/Windows Phone 7)?

Mar 29, 2012 at 11:11 AM
Edited Mar 29, 2012 at 11:19 AM

I'm using Windows Phone 7

	    ScriptEngine engine = new ScriptEngine();
            engine.CompatibilityMode = CompatibilityMode.ECMAScript3;
            try
            {
                engine.Evaluate("function test() {for (var i = 0; i < 6; i++) {	if (i == 3) {   continue; }	} } test();");
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("parseScript Execption {0}", ex.ToString());
            }

Coordinator
Apr 6, 2012 at 1:50 PM

There are quite a few known issues on WP7 (support is not finished yet), but I'll look into it.

Apr 13, 2012 at 1:48 AM
paulbartrum wrote:

There are quite a few known issues on WP7 (support is not finished yet), but I'll look into it.

Hi

Has this problem been solved?

Coordinator
Apr 16, 2012 at 10:43 PM

Sorry, code generation bugs take a lot of time to investigate and I haven't had a chance yet.