If you attempt to clone and cast an array it fails. The clone method fails
because the implementation type of the array has changed and clone() is needed
there too.
[JsType(JsMode.Clr, Filename = "res/CLR.js")]
public static class ArrayTest
{
public static void CloneArray()
{
var values = new int[10];
var newValues = (int[]) values.Clone();
}
}
[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)
{
ArrayTest.CloneArray();
}
}
Error:
Uncaught TypeError: Object #<Int32Array> has no method 'Clone'
If you define the clone method in jsclr.js e.g.
Int32Array.prototype.Clone = function () { return new Int32Array(this); }
then you get a failure in the cast.
Uncaught Error: InvalidCastException: Cannot cast object to ArrayException generated by JsRuntime
The issue with the cast is likely to be an issue elsewhere than just cloning.
/*Generated by SharpKit 5 v5.01.8000*/
Original issue reported on code.google.com by co...@gravill.com on 22 Jul 2013 at 4:17
Original issue reported on code.google.com by
co...@gravill.com
on 22 Jul 2013 at 4:17