Callbacks from C to C# are not working in 5.4.0f3

Here is my simple flow of callback from ios to unity.

private delegate void CallbackDelegate();

[DllImport("__Internal")]
private static extern void PluginFunction(CallbackDelegate callback);

void Start()
{
    PluginFunction(CallbackMethod);
}

[MonoPInvokeCallback(typeof(CallbackDelegate))]
void CallbackMethod()
{
   Debug.Log("Working...");
}

C side code

extern "C" typedef void (*CallBackFuncP) ();

extern "C" {
    void PluginFunction(CallBackFuncP callback) {
        callback();
    }
}

I am getting this exception after upgrading to Unity 5.4.0f3 working on previous version

Blockquote NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code.

You’ll need to change CallbackMethod to be defined like this:

 [MonoPInvokeCallback(typeof(CallbackDelegate))]
 static void CallbackMethod()
 {
    Debug.Log("Working...");
 }

For both IL2CPP and Mono on an AOT platform (like iOS) it is not possible to marshal an instance method to a function pointer that can be called from native code. Only static methods in C# code be called from native code like this.