This repository was archived by the owner on Aug 24, 2022. It is now read-only.
  
  
  
  
  
Description
In .Net, you can create delegate to instance method that will accept object on which you want call it as first delegate call argument. It is not supported in JSIL. Here is small test case:
using System;
using System.Runtime.InteropServices;
public static class Program
{
    public static void Main()
    {
        var d = (Action<ClassWithInstanceMember>)Delegate.CreateDelegate(typeof(Action<ClassWithInstanceMember>), null, typeof(ClassWithInstanceMember).GetMethod("Run"));
        d(new ClassWithInstanceMember(1));
        d(null);
    }
}
public class ClassWithInstanceMember
{
    public int _value;
    public ClassWithInstanceMember(int value)
    {
        _value = value;
    }
    public void Run()
    {
        if (this != null)
        {
            Console.WriteLine("this: " + _value);
        }
        else
        {
            Console.WriteLine("this==null ");
        }
    }
}
I will work on this issue, as it is requirement for Expression Interpreter work with instance methods. Full test case should check:
- Non-generic methods in non-generic class
- Generic methods in non-generic class
- Non-generic methods in generic class
- Generic methods in generic class
- Non-generic methods in non-generic interface
- Generic methods in non-generic interface
- Non-generic methods in generic interface
- Generic methods in generic interface