Error with emote handling

I am attempting to create a server from scratch using my own plugins, yes I know it would be alot easier to use premade plugins, however this is both fun and a challenge for me.

I am attempting to create a simple /e command that will force the players ped to perform the emote.

I am getting this error however.

Error invoking callback for event Emote: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.MethodAccessException: Error verifying KronusClient.Client/d__8:MoveNext (): Method System.Exception:get_Source () is not accessible at 0x00d3
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <74fbbe963b7e417b8d715b858c5c584f>:0
at KronusClient.Client.UserDoEmote (System.Int32 PedInt, System.String rawArg) [0x0002d] in :0
at KronusClient.Client.<.ctor>b__0_1 (System.Int32 src, System.String args) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <74fbbe963b7e417b8d715b858c5c584f>:0
— End of inner exception stack trace —
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <74fbbe963b7e417b8d715b858c5c584f>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <74fbbe963b7e417b8d715b858c5c584f>:0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <74fbbe963b7e417b8d715b858c5c584f>:0
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <74fbbe963b7e417b8d715b858c5c584f>:0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <74fbbe963b7e417b8d715b858c5c584f>:0
at CitizenFX.Core.EventHandlerEntry+d__5.MoveNext () [0x00064] in C:\gl\builds\edf06b9b\0\cfx\fivem\code\client\clrcore\EventHandlerDictionary.cs:89

This is my code:

public static Dictionary<string, string> EmoteNamePairs;
void PopulateDictionary()
{
if (EmoteNamePairs == null)
{
EmoteNamePairs = new Dictionary<string, string>();
EmoteNamePairs.Add(“lean”, “world_human_lean_male_foot_up_lo_res_base”);
}
}
public async void UserDoEmote(int PedInt, string rawArg)
{
PopulateDictionary();
try
{

            var Emote = EmoteNamePairs.Where(x => x.Key == "lean").FirstOrDefault();
            PlayEmote(Emote.Value);
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Source + "//" + ex.Message);
        }
    }
    void PlayEmote(string emoteName)
    {
        Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, Game.PlayerPed.Handle, emoteName, 0, false);
    }

bump Assistance is very much appreciated.

Double Bump :frowning:

Triple Bump :frowning: Really want to fix this. :sob:

Please guys, I really want emotes, I tried looking at similar C# Apps on GH etc, they are all similar, but rely on keybinds rather than commands, and it seems to be the command that is having the issue.