Search code examples
c#exceptionaccessormissingmethodexception

Accessors and MissingMethodException


I am referencing an automatically generated DLL in my code which I can not really control.

This file has tons of class-definitions like the one below:

namespace _Outputs.CEEM
{
    public sealed class DoorDrvrSts : SystemVariableBase, ITypedRuntimeValue<int>, IRuntimeValue
    {
        public const int Clsd_DoorDrvrSts = 2;
        public const int Opend_DoorDrvrSts = 1;
        public const int Ukwn_DoorDrvrSts = 0;

        public static DoorDrvrSts Instance { get; }
        public int TypedValue { get; set; }
        public static int Value { get; set; }

        protected override void DoInvalidateInstance();

        public delegate void ValueChanged();
    }
}

This is how I try to use the above class:

_Outputs.CEEM.DoorDrvrSts.Value = _Outputs.CEEM.DoorDrvrSts.Ukwn_DoorDrvrSts;

But then I get the following exception:

A .NET exception (MissingMethodException) occured in the module PowerManagement
Error message: Method not found: 'Void _Outputs.CEEM.DoorDrvrSts.set_Value(Int32)'.
Throwing method: PowerManagement.DoTest

This whole issue started when we received a new library which the DLLs are generated from. I really have no idea where to look! I have regenerated the DLLs and made sure those are the ones actually references in my solution.

Does anyone have any other idea? When we run the exact same code on other machines (exact same hw, sw, .NET and windows as I can see) we get no issues. What could that mean?


Solution

  • Patrick, your answer was certainly helpful but my problem was that wrong DLL was actually being used. I used Ms process explorer to find out was what DLL was being used, then I removed that file (which should not have been used in the first place) and generated a new one in the right location och it solved my issues.