[ModApi] exception throw on IMyLandingGear.LockModeChanged event handler registry

Sisk S'jet shared this bug 16 months ago
Considered

When we try to register an event handler for IMyLandingGear.LockModeChanged, an exception is thrown:

Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
Testing code:

using Sandbox.Common.ObjectBuilders;
using SpaceEngineers.Game.ModAPI;
using VRage.Game.Components;
using VRage.ModAPI;
using VRage.ObjectBuilders;

namespace Test {
    [MyEntityComponentDescriptor(typeof(MyObjectBuilder_LandingGear), false)]
    public class LandingGearLogic : MyGameLogicComponent {
        private IMyLandingGear _landingGear;

        public override void Close() {
            _landingGear.LockModeChanged -= OnLockModeChanged;
        }

        public override void Init(MyObjectBuilder_EntityBase objectBuilder) {
            _landingGear = Entity as IMyLandingGear;
            NeedsUpdate = MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
        }

        public override void UpdateOnceBeforeFrame() {
            _landingGear.LockModeChanged += OnLockModeChanged;
        }

        private void OnLockModeChanged(IMyLandingGear gear, SpaceEngineers.Game.ModAPI.Ingame.LandingGearMode mode) { }
    }
}

Comments (1)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.

Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department