Constructor executed twice when overriding constructor in System.Object.

Environment

  • Pythonnet version: 2.3.0
  • Python version: 2.7.13
  • Operating System: Windows 10

Details

We are trying to create a subclass of System.Object (using namespace) and override the constructor.

For some reason, the conctructor is executed twice when an instance of the class is created. Below is an example that reproduces the problem.

class X(System.Object):
    __namespace__ = "PyTest"

    def __init__(self):
        print("Running X constructor")

x = X()

The output is

Running X constructor
Running X constructor