Using on Mono and Have Problem

Mar 14, 2012 at 8:04 PM

I using JInt on Mono and have a real problem. In the example source code you have the following:

print('Update object using method');

The method SetTimestamp is called, but the problem exists on the exit of the method:

public override JsInstance Execute(Jint.Expressions.IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters)
            JsInstance retval = null;
            try {
                retval = m_impl(visitor.Global, that, parameters);
            catch( Exception ex) {
                Console.WriteLine( "oops => " + ex);
            visitor.Return(  retval);
            return that;

I took your source code and rewrote it a bit. When SetTimestamp exits it causes an exception within the implementation reference to m_impl. That exception is:

oops => System.NullReferenceException: Object reference not set to an instance of an object
at (wrapper dynamic-method) Jint.Marshal.ProxyHelper.jsWrapper (Jint.Native.IGlobal,Jint.Native.JsInstance,Jint.Native.JsInstance[]) <IL 0x00054, 0x001dc>
at Jint.Native.NativeMethod.Execute (Jint.Expressions.IJintVisitor,Jint.Native.JsDictionaryObject,Jint.Native.JsInstance[]) [0x00002] in /home/christianhgross/software/vendors/jint_c9ff70a2ae3e/Jint/Native/NativeMethod.cs:74

I am a bit lost here...

Mar 26, 2012 at 7:43 PM

This issue should be fixed in 'dev' branch, you can try it.

Mar 27, 2012 at 1:47 AM

Ok will give it a shot and let you know...

Mar 27, 2012 at 3:32 PM
Edited Mar 27, 2012 at 3:34 PM


Mar 27, 2012 at 3:34 PM
Edited Mar 27, 2012 at 3:34 PM

I have been trying to get the code to run and no go... I used the shell and cannot even get the following to work:

var temp = new Jint.Shell.Execute();

This is a class that I defined within the assembly. The error I get is Function Expected.

If you could, in your old sources you had this program called temp where there was a bunch of source code. Please try that as it seems to be fraught with errors.

I have been experimenting with the shell program and using SetFunction, and SetParameter functionality. That is working... So I think there is progress...

Mar 27, 2012 at 3:56 PM

OK having experimented more, generally speaking it seems to be working. I have to stay away from the code that was illustrated and instead use a class factory of a property that is assigned. I can live with that actually... So now I will be integrating this into a piece of software and let you know how it goes.

Mar 28, 2012 at 2:22 PM

Please note, that regular .net methods can't be used as constructors.