-
Notifications
You must be signed in to change notification settings - Fork 242
ObservableCollection<string> not working but List<string> is working #288
Comments
Hello again, For now, I can only add some test cases: |
There is no tutorial but there are some past issues on the JSIL project here on github where I have answered questions; you might want to look through those. At some point I may write a comprehensive tutorial. At present, feel free to ask specific questions. Debugging is done using the JS debuggers in Firefox, IE and Chrome. Most features are implemented in the .js files, by hand, using Externals. A few features are implemented using proxies (see the Proxies projects in the JSIL sln) in which case they're a mix of JSReplacement and cross-compiled C#. |
I try to debug PropertyChangedEventArgs which seems possible to me (ObservableCollection is more advanced one I think). If I switch to this function in System.js, the PropertyChangedEventArgs constructor error is never thrown: (function PropertyChangedEventArgs$Members () {
var $, $thisType;
var $T00 = function () {
return ($T00 = JSIL.Memoize($asm03.System.String)) ();
};
var $T01 = function () {
return ($T01 = JSIL.Memoize($asm03.System.EventArgs)) ();
};
function PropertyChangedEventArgs__ctor (propertyName) {
$T01().prototype._ctor.call(this);
this.propertyName = propertyName;
};
function PropertyChangedEventArgs_get_PropertyName () {
return this.propertyName;
};
JSIL.MakeClass($asm03.TypeRef("System.EventArgs"), "System.ComponentModel.PropertyChangedEventArgs", true, [], function ($interfaceBuilder) {
$ = $interfaceBuilder;
$.Method({Static:false, Public:true }, ".ctor",
new JSIL.MethodSignature(null, [$.String], []),
PropertyChangedEventArgs__ctor
);
$.Method({Static:false, Public:true , Virtual:true }, "get_PropertyName",
new JSIL.MethodSignature($.String, [], []),
PropertyChangedEventArgs_get_PropertyName
);
$.Field({Static:false, Public:false, ReadOnly:true }, "propertyName", $.String);
$.Property({Static:false, Public:true , Virtual:true }, "PropertyName", $.String);
//$.ExternalMethod({Static:false, Public:true }, ".ctor",
// new JSIL.MethodSignature(null, [$.String], [])
//)
// .Attribute($asm04.TypeRef("__DynamicallyInvokableAttribute"))
// .Attribute($asm03.TypeRef("System.Runtime.TargetedPatchingOptOutAttribute"), function () { return ["Performance critical to inline this type of method across NGen image boundaries"]; });
//$.ExternalMethod({Static:false, Public:true , Virtual:true }, "get_PropertyName",
// new JSIL.MethodSignature($.String, [], [])
//)
// .Attribute($asm04.TypeRef("__DynamicallyInvokableAttribute"))
// .Attribute($asm03.TypeRef("System.Runtime.TargetedPatchingOptOutAttribute"), function () { return ["Performance critical to inline this type of method across NGen image boundaries"]; });
//$.Field({Static:false, Public:false, ReadOnly:true }, "propertyName", $.String);
//$.Property({Static:false, Public:true , Virtual:true }, "PropertyName", $.String)
// .Attribute($asm04.TypeRef("__DynamicallyInvokableAttribute"));
return function (newThisType) { $thisType = newThisType; };
})
.Attribute($asm04.TypeRef("__DynamicallyInvokableAttribute"));
})(); From there, I don't know how to tell the compiler to use this function instead of previous one. |
I'm studying... |
Why was this closed? I see some possible workarounds but ObservableCollections still do not work with JSIL. |
Issue was closed by original reporter. |
If it doesn't work in translated BCL, definitely file an issue about that. |
Hello,
I'd like to use ObservableCollection instead of List to get changed notifications easily, but it doesn't seems to work.
Here is my little test case:
System.Collections.ObjectModel.ObservableCollection obs = new System.Collections.ObjectModel.ObservableCollection() { "str1", "str2" };
obs.Add("str3");
System.Diagnostics.Debug.WriteLine("count obs:" + obs.Count);
System.Collections.Generic.List list = new System.Collections.Generic.List() { "str1", "str2" };
list.Add("str3");
System.Diagnostics.Debug.WriteLine("count list:" + list.Count);
Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: