Debugging CallFunction

Jan 2, 2012 at 2:43 PM
Edited Jan 2, 2012 at 2:45 PM

Hi,

Is it possible to get debugging on CallFunction? For example, say this is my script:

function test() {
    var a = 5;
    var b = 10;
    return a * b + invalid();
}

And this is my C# code to call the script:

            JintEngine jint = new JintEngine();
            jint.SetDebugMode(true);
            jint.Run(File.ReadAllText("Test.js"));
            try {
                double ret = (double)jint.CallFunction("test");
                Console.WriteLine(ret);
            } catch (Jint.Native.JsException ex) {
                Console.WriteLine(ex.StackTrace);
            }

If there's an error in the script when Run is called, it happily gives you the line/char number. However, if you call it via CallFunction, it gives you a boring Jint.Native.JsException without any info on where the error happened. Am I missing something, or is this by design? If so, how can I get the line/char number?

Thanks!

Jan 24, 2012 at 7:54 AM

Bump.

Sep 17, 2012 at 10:06 AM

Hi everyone

I'm facing the same problem. Being able to debug code that runs when CallFunction is used would be great.

Cheers
Tiago

Mar 9, 2013 at 12:32 AM
don't you have to write the function like thus

var test = function(){
code;
code;
etc etc;;
}