Trying to insert an item via the dictionary indexer.
[JsType(JsMode.Clr, Filename = "res/DictionaryTest.js")]
public class DictionaryTest
{
public static void Setter()
{
var dict = new Dictionary<string, string>();
dict.Add("test", "OK"); //OK
dict["hello"] = "world"; //Throws exception
}
}
[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)
{
new jQuery(HtmlContext.document.body).append("Hello world<br/>");
DictionaryTest.Setter();
}
}
Doing this results in a KeyNotFoundException. The method seems to have an
excessive check -
set_Item$$TKey: function (key, value)
{
if (!this.ContainsKey(key))
throw $CreateException(new System.Collections.Generic.KeyNotFoundException.ctor$$String("The specified key does not exist."), new Error());
This should insert the value - that's the behaviour in C#
/*Generated by SharpKit 5 v5.00.0000*/
Original issue reported on code.google.com by co...@gravill.com on 30 Oct 2012 at 11:51
Original issue reported on code.google.com by
co...@gravill.com
on 30 Oct 2012 at 11:51