Background

My company currently has an application that uses the VSAEngine to compile and evaluate simple expressions and custom function libraries within the context of a larger Framework.

When the Framework is loaded, we extract scripts from a configuration file and compile them, and can later evaluate generic expressions involving the Framework object itself, its member variables andmethods, as well as the custom functions from theconfiguration file.

We've run into performance issues stemming from (we believe) AppDomain creation andrepeated compilation of scripts. Wemoved toAppDomain creation when it was clear that the VSAEngine was not being unloaded from memory in between calls, causing memory leaks.

The Question

I'm looking for a replacement that will allowus to Eval expressions, without having to recompile the script each timea new request comes in.

What I've tried so far

I've attempted to create a compiled JScript.NET DLL (Evaluator) that accepts a Framework instance in the constructor, and contains a single function 'Evaluate' that accepts an expression and simply calls Eval on it. This works for simple expressions, but does not support custom functions referencing the Framework. When I attempt to use the Framework in a method call, JScript complains that I'm attempting to call a Non-static member from a static member. This confuses me since each framework creates its own instance of the Evaluator class.

I haven't spent a considerable amount of time working with the CodeDOM because I'm trying to avoid compilation when the Framework loads. Our application can handle some per-function-call inefficiencies but not long delays in load times. If there was a way of compiling the script in its initial state, and passing the framework to a re-hydrated instance of that script, I'd be interested in hearing it. We can't reuse the same script instance after it's been through a call though - we have no control over global variables in scripts and I'd like to prevent one instance from tainting another.