Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Troubleshooting FAQ

Kostromin Igor edited this page Apr 27, 2014 · 1 revision

I have an error like 'Method XXX has not been implemented'

You can try to add this manually.

  • Firstly, it is need to realize, what assembly stub should contain missing method. For example, we are dealing with error

Error: The external method 'void .ctor(System.String)' of type 'System.ComponentModel.PropertyChangedEventArgs' has not been implemented. at Object.ExternalMemberStub

Class System.ComponentModel.PropertyChangedEventArgs is inside System assembly, so it seems to we should edit Libraries/JSIL.Bootstrap.js file.

  • Find the code in corresponding js-stub file (may be this type is already exists ?). And if it is, we'll add the code in this place.

  • Add the implementation like this:

JSIL.ImplementExternals("System.ComponentModel.PropertyChangedEventArgs", function ($) {
  $.Method({Static: false, Public: true}, ".ctor",
    new JSIL.MethodSignature(null, [$jsilcore.TypeRef("System.String")], []),
    function(propertyName) {
        this.propertyName = propertyName;
    }
  );

  $.Method({Static: false, Public: true, Virtual:true}, "get_PropertyName",
    new JSIL.MethodSignature($.String, [], []),
    function() {
        return this.propertyName;
    }
  );
});

Static, Public and Virtual attributes should correspond to real method attributes. Implementation can be spied using any .NET decompiler. Method signature args are: return type, args types, generic parameters. If you want to add explicit interface implementation, you can try to use this pattern:

$.Method(
  // A method doesn't have to be public to implement an interface
  {Static: false, Public: false }, 
  // Passing null for the name makes the method anonymous
  null,
  new JSIL.MethodSignature($.Int32, [$.Object], []),
  addImpl
).Overrides("System.Collections.IList", "Add");