{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/a749cd6560a3b7e5a368d15faa7f2bc0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a749cd6560a3b7e5a368d15faa7f2bc0","url":"https://api.github.com/users/matra774","login":"matra774","id":1160680},"milestone":null,"assignee":null,"updated_at":"2011-11-13T10:00:42Z","labels":[],"comments":2,"closed_at":null,"url":"https://api.github.com/repos/kevingadd/JSIL/issues/36","body":"Hi,\r\n\r\nThe following code\r\n    \r\n     var cache = new Dictionary<string, string>()\r\n      {\r\n        {\"key1\",\"value1\" },\r\n      };\r\n\r\nGenerates wrong Javascript. Note that only key is initialized, but not the value. I'm guessing that the wrong initializer is called. The following code is generated:\r\n\r\n    var cache = JSIL.Cast(JSIL.New(System.Collections.Generic.Dictionary$b2.Of(System.String, System.String), \"_ctor$0\", [])\r\n    .__Initialize__([\"key1\"]), System.Collections.Generic.Dictionary$b2.Of(System.String, System.String));\r\n\r\nHere is the version of JavaScript with all optimizations turned off:\r\n\r\n    var cache = JSIL.Cast((JSIL.New(System.Collections.Generic.Dictionary$b2.Of(System.String, System.String), \"_ctor$0\", [])\r\n    = new JSIL.CollectionInitializer(\"key1\")), System.Collections.Generic.Dictionary$b2.Of(System.String, System.String));\r\n\r\nMatra","html_url":"https://github.com/kevingadd/JSIL/issues/36","title":"Bug: Dictionary initializer only initializes keys, but not values","number":36,"id":2218893,"created_at":"2011-11-12T21:29:10Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/a749cd6560a3b7e5a368d15faa7f2bc0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a749cd6560a3b7e5a368d15faa7f2bc0","url":"https://api.github.com/users/matra774","login":"matra774","id":1160680},"updated_at":"2011-11-13T10:00:42Z","url":"https://api.github.com/repos/kevingadd/JSIL/issues/comments/2721552","body":"Update: I have also updated Jsil.Core.js so that it know how to initialized dictionaries:\r\n\r\n    JSIL.CollectionInitializer.prototype.Apply = function (target) {\r\n      var values;\r\n\r\n      // This method is designed to support being applied to a regular array as well\r\n      if (this.hasOwnProperty(\"values\"))\r\n        values = this.values;\r\n      else\r\n        values = this;\r\n\r\n      if (typeof (target._dict) != \"undefined\")  // matra774 implemented initialization of dictionaries\r\n      {\r\n       for (var i = 0, l = values.length; i < l; i+=2) \r\n       {\r\n         target.Add(values[i],values[i+1]);\r\n       }\r\n      }\r\n      else\r\n      {\r\n        for (var i = 0, l = values.length; i < l; i++)\r\n          target.Add(values[i]);\r\n      }\r\n    };\r\n\r\n\r\n... ut now I have run into another problem. It looks like client side Dicitonaries only support indexing dictionaries strings. So If I have add two different keys that are of same non-string type, they result in single dictionary entry.\r\n\r\nWhy is client side dictionary using 'String(key)' instead of 'key' when adding to the dictionary?","id":2721552,"created_at":"2011-11-13T10:00:42Z"}}