.NET Framework Bookmark and Share   
 index > JScript for the .NET Framework > Problem with Eval.JScriptEvaluate
 

Problem with Eval.JScriptEvaluate

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

NRamanan
Hi,

Please try to put the code into try catch block, and show the expression to see which one is causing the error.

It seems an expressionis invalid.

Harry


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Harry Zhu
Hi Harry,

Thanks for the response.
I already gave try..catch block for the code and executed. But as I have specified in my post, while debugging, that error never arises. And ofcourse, the expression coming inside is always correct. Because, for testing purpose we had given the rule expression to contain either true or false, not a combination ofboolean values.
In release mode, i.e. after deployment it gives this error unexpectedly.

Thanks
NRamanan

You can use google to search for other answers

Custom Search

More Threads

• How to Highlight the items in listbox in javascript
• [HTTP]Check software on client side
• Reduce number of lines to a single array?, Any experts pls help
• How to check whether a software is installed in the client machine from IE?
• how to install suport for jscript into visual web developer 2008 express edition?
• Calling Javascript using C# WinForm
• ECMAScript 4 Release Date
• Open a file with client application
• 2008 New Nike Football Shoes in www.shoes198.com
• WebForm_SaveScrollPositionSubmit is not defined