Ejemplo n.º 1
0
 public NativeApiContainer(INativeContext ctx)
 {
     _ctx = ctx;
     // Virtual member call should be fine unless we have a rogue implementer
     // The only implementer of this function should be SilkTouch
     // ReSharper disable VirtualMemberCallInConstructor
     _vTable   = CreateVTable();
     GcUtility = new GcUtility(1, CoreGcSlotCount());
     PostInit();
     // ReSharper restore VirtualMemberCallInConstructor
 }
Ejemplo n.º 2
0
        protected NativeApiContainer(INativeContext ctx)
        {
            _ctx = ctx;
            // Virtual member call should be fine unless we have a rogue implementer
            // The only implementer of this function should be SilkTouch
            // ReSharper disable VirtualMemberCallInConstructor
            _vTable = CreateVTable();
            var slotCount = CoreGetSlotCount();

            if (slotCount == 0)
            {
                throw new InvalidOperationException
                      (
                          "The derived class does not implement CoreGetSlotCount, or does not have any slots." +
                          "This could be because of a SilkTouch bug, or because you're not using SilkTouch at all."
                      );
            }
            _vTable.Initialize(_ctx, slotCount);
            GcUtility = new GcUtility(1, CoreGcSlotCount());
            // ReSharper restore VirtualMemberCallInConstructor
        }