Using methods with out parameters on typed arrays fail. The issue is that the
intermediate object structure gets coerced to the type of the array.
[JsType(JsMode.Global, Filename = "res/Default.js")]
public class DefaultClient
{
static void DefaultClient_Load()
{
new jQuery(HtmlContext.document.body).append("Ready<br/>");
}
static void btnTest_click(DOMEvent e)
{
Init.tryWithArray();
}
}
//Example method
public static void TryParse(string text, out int target)
{
if (text == "1")
{
target = 1;
}
else
{
target = -1;
}
}
public static void tryWithArray()
{
var output = new int[1];
output[0] = 7;
TryParse("1", out output[0]);
new jQuery(HtmlContext.document.body).append(output[0]);
}
You can see the problem in the JavaScript:
tryWithArray: function ()
{
var output = new Int32Array(1);
output[0] = 7;
(function ()
{
output[0] = {Value: output[0]};
var $res = SharpKitWebApp1.Init.TryParse("1", output[0]);
output[0] = output[0].Value;
return $res;
})();
$(document.body).append(output[0]);
}
Specifically the line: output[0] = {Value: output[0]};
/*Generated by SharpKit 5 v5.2.0*/
Original issue reported on code.google.com by co...@gravill.com on 8 Aug 2013 at 9:48
Original issue reported on code.google.com by
co...@gravill.com
on 8 Aug 2013 at 9:48