Skip to content

Error in bind python function with C#'s delegate #1507

Closed
@GentlerMan

Description

@GentlerMan

Environment

  • Pythonnet version:2.5.2
  • Python version:3.8
  • Operating System:win10
  • .NET Runtime:4.7.2

Details

I want to bind python function with C#'s delegate method in winform
  • C# Code
public delegate string CallBackFunc(string content);
using (Py.GIL())
  {
      using (PyScope scope = Py.CreateScope())
      {
          scope.Set("main", this);
          scope.Exec(pycode);
      }
  }
  • Python Code
def test(input):
   return "OK"
res = main.CallBackFunc(test)

When I test in program ,GET the Error Infomation:Type was not found "System. Reflection. Emit. TypeBuilder" on the constructor,
What should I do For this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions