[Solved] System.MethodAccessException ... MoveNext() is not accessible

Hi everybody,

I’m trying to use C# for creating client Resource. But it’s not work. I have a ugly message in the client log. There is the stack trace :

Failed to run a tick for FirstResourceClient: System.MethodAccessException: Error verifying FirstClient.FirstResourceClient/<TickEvent>d__1:MoveNext (): Method System.Array:Empty<object> () is not accessible at 0x0014
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 
at FirstClient.FirstResourceClient.TickEvent () [0x00026] in <056e0eba4e2141da81c0fe14fab6fac6>:0 
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 
at System.Threading.Tasks.Task.Execute () [0x00010] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

There is the code. It’s seems very simple, but it’s bug :frowning:

namespace FirstClient
{
    public class FirstResourceClient : BaseScript
    {
        public FirstResourceClient()
        {
            Tick += TickEvent;
        }

        public async Task TickEvent()
        {
            Debug.WriteLine("HelloClient");
            await Delay(100);
        }
    }
}

Any body can help me to solve my problem ?

Thanks

Is your project targeting .NET version 4.5.2?

Yeah, it’s work.
I don’t check the Microsoft documentation :


It says Empty is available since 4.6.

Thanks a lot !