CSharp.lua icon indicating copy to clipboard operation
CSharp.lua copied to clipboard

Metadata ctor is incorrect

Open Drake53 opened this issue 3 years ago • 1 comments

https://github.com/Drake53/CSharp.lua/issues/2

Drake53 avatar Jul 22 '22 14:07 Drake53

namespace Test {
  public class A {
    public A(int a, string b = null) {
    }
  }

  public class Program
  {
    private static void Main(string[] args)
    {
      Activator.CreateInstance(typeof(A),  100);
    }
  }
}

i run this code in .NET6, it also got a exception, so in lua it will also got a error

Unhandled exception. System.MissingMethodException: Constructor on type 'Test.A' not found.
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, Object[] args)
   at Test.Program.Main(String[] args) in C:\Person\Project\code\cstolua\cstolua\src\Progrom.cs:line 20

yanghuan avatar Aug 01 '22 16:08 yanghuan