Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Weird Parameter Passing Behavior

$
0
0
No. Here is my exact code with your test above. (Little messier for testing purposes.)
Public Function InvokeJSFunction(name As String, args() As Object)
        Dim host As New HostFunctions
        JSEngine.AddHostType("Console", GetType(System.Console))
        JSEngine.Execute("function foo(arg) { Console.WriteLine('Foo: {0}', arg); }")
        name = "foo"
        args = {123.456}
        CType(host, IScriptableObject).OnExposedToScriptCode(JSEngine)
        Dim func = host.getProperty(CType(JSEngine.Script, IDynamicMetaObjectProvider), name)
        Dim del = CType(host.func(Of Object)(args.Length, func), System.Delegate)
        InvokeJSFunction = del.DynamicInvoke(args)
    End Function
It fails at the same part, granted I am sending arguments this time.
public TResult InvokeTarget(T1 a1)
            {
                return Invoke(() => (TResult)target(a1));
            }
Any ideas?

-JC

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>