You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pass ArrayList CLR object to JS and try to try to access element from the array like:
var element = arrayList.Item[0];
or
var element = arrayList.get_item(0);
Observed behavior:
First code fails with error "No overload for method 'get_Item' takes 0 arguments".
Second code fails with error "'arrayList.get_Item' is not a function".
Expected behavior:
The first code will obviously not work because there are no indexed properties in JS. The second code should work.
Propoposed solution:
ClrStaticTypeWrapper.PopulateMembers method must be modified to call PropertyInfo.GetIndexParameters method to verify if property is indexed. If property is indexed, it should not be setup as JS property. This is the code I propose:
case MemberTypes.Property:
PropertyInfo property = (PropertyInfo)member;
if ( property.GetIndexParameters().Length > 0 )
{ // Indexed property. Do not setup as property.
continue;
}
...
The text was updated successfully, but these errors were encountered:
It's likely this code is either going away, or at least moved into a separate package, so I'm not going to make any changes to ClrStaticTypeWrapper for the forseeable future. I'll keep the issue open in case I reconsider.
Reproduction:
var element = arrayList.Item[0];
or
var element = arrayList.get_item(0);
Observed behavior:
First code fails with error "No overload for method 'get_Item' takes 0 arguments".
Second code fails with error "'arrayList.get_Item' is not a function".
Expected behavior:
The first code will obviously not work because there are no indexed properties in JS. The second code should work.
Propoposed solution:
ClrStaticTypeWrapper.PopulateMembers method must be modified to call PropertyInfo.GetIndexParameters method to verify if property is indexed. If property is indexed, it should not be setup as JS property. This is the code I propose:
The text was updated successfully, but these errors were encountered: