Problem with Eval.JScriptEvaluate

May 28 2009 5:11 AM

Hi

I have one issue coming up in using Eval.JScriptEvaluate

In our application we are processing several thousands of item using some rule expression. The rule expression will be looking like (true || true) && (true || false || true), for e.g.

To process this rule expression we are using JScriptEvaluate.

The code used in the application goes like this,

public static object EvalExpression(string Expression)

{

VsaEngine Engine = VsaEngine.CreateEngine();

return Eval.JScriptEvaluate(Expression, "unsafe", Engine);

}

The problem with this code is, sometimes it gives the following error. I have pasted the error here with its stack trace.

Index was outside the bounds of the array.

at Microsoft.JScript.Stack.Push(Object item)

at Microsoft.JScript.Eval.DoEvaluate(Object source, VsaEngine engine, Boolean isUnsafe)

We cannot predict when this error comes. While debugging the error did not show up at all. But in release mode, once in 10 times or so this error comes.

I tried closing the VsaEngine instance and recreate it again.

But it ended up with another exception which says, "Microsoft.Vsa.VsaException: EngineClosed (0x80133011)".

Can anyone give some idea on how to resolve this issue?

Thanks


Answers (1)