Skip to content

Instantly share code, notes, and snippets.

@garata
Created December 21, 2017 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garata/150e92605a2cfcfdaa5acea34a93f404 to your computer and use it in GitHub Desktop.
Save garata/150e92605a2cfcfdaa5acea34a93f404 to your computer and use it in GitHub Desktop.
JSIL 1051 issue
using System;
using JSIL;
using JSIL.Meta;
class Class1
{
public Class1()
{
Delegate d = new Action<int>(
(int someVar) =>
{
});
var p = d.Method.GetParameters(); // TypeError: d.get_Method(...) is null
}
}
class Class2
{
public Class2()
{
MemberMethod();
}
public void MemberMethod()
{
Delegate d = new Action<int>(
(int someVar) =>
{
});
var p = d.Method.GetParameters(); // TypeError: d.get_Method(...) is null
}
}
public static class Program {
public static void Main () {
Delegate d = new Action<int>(
(int console) =>
{
});
var p = d.Method.GetParameters();
Console.WriteLine("Static method version works.");
Class2 clazz2 = new Class2();
Console.WriteLine("Member method call version works.");
Class1 clazz1 = new Class1();
//Crash
Console.WriteLine("Ctor method version works.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment