InvokeAsync<object> fails for string parameters and result #60

Closed
opened 2025-08-09 17:14:51 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @samcov on 5/18/2018

If I do something simple like:
object[] obj = new object[] { 10, 3 };
var ret = await _nodeServices.InvokeAsync<object>("./NodeScripts/Add.js", obj);

Where Add.js simply adds two numbers together, it works without issue, however if I do this,
object[] obj = new object[] { 10+"", 3+"" };
var ret = await _nodeServices.InvokeAsync<object>("./NodeScripts/Add.js", obj);

It fails complaining about a non-json string, but if I do this, it works properly
object[] obj = new object[] { 10 + "", 3 + "" };
var ret = await _nodeServices.InvokeAsync<string>("./NodeScripts/Add.js", obj);

It works properly. I would assume that using type object would cover anything, but it doesn't appear to work. I'm not sure what's going on, and I don't want to have to figure out types on the fly.

*Originally created by @samcov on 5/18/2018* If I do something simple like: object[] obj = new object[] { 10, 3 }; var ret = await _nodeServices.InvokeAsync<**object**>("./NodeScripts/Add.js", obj); Where Add.js simply adds two numbers together, it works without issue, however if I do this, object[] obj = new object[] { 10+"", 3+"" }; var ret = await _nodeServices.InvokeAsync<**object**>("./NodeScripts/Add.js", obj); It fails complaining about a non-json string, but if I do this, it works properly object[] obj = new object[] { 10 + "", 3 + "" }; var ret = await _nodeServices.InvokeAsync<**string**>("./NodeScripts/Add.js", obj); It works properly. I would assume that using type object would cover anything, but it doesn't appear to work. I'm not sure what's going on, and I don't want to have to figure out types on the fly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#60
No description provided.