C# weird problem


#1

hi, with the recent server build (tested with 433-04d3ad00999cde5a4aa2ac2056eb442f526da6b0 27-Nov-2017 23:34), i have some trouble for trigger events.

I have a compiler warning because of (server) CitizenFX.Core.dll target is x64
Before the recent updates all my dll’s with target ‘any cpu’ was working just fine.

but now a simple event throw error

Server Side

        public SpawnManager()
        {
            EventHandlers[ExoEvents.ReqSpawn] += new Action<Player>(OnRequestSpawn);
        }

        public void OnRequestSpawn([FromSource] Player player)
        {
            dynamic dyn = new ExpandoObject();
            dyn.Data1 = XXXXXX;
            dyn.Data2 = YYYYYY;
            dyn.Data3 = ZZZZZZ;
            TriggerClientEvent(player, ExoEvents.Spawn, dyn);
        }

throw this error

[     92140] Error invoking callback for event Exo:ReqSpawn: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetParameterCountException: Number of parameters specified does not match the expected number.
[     92156]   at System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92156]   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00011] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92171]   at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00038] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92171]   at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x0008a] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92187]   at CitizenFX.Core.MsgPackSerializer.Serialize (System.Object obj, MsgPack.Packer packer) [0x0025f] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackSerializer.cs:140 
[     92187]   at CitizenFX.Core.MsgPackSerializer.Serialize (System.Object obj, MsgPack.Packer packer) [0x000fb] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackSerializer.cs:97 
[     92203]   at CitizenFX.Core.MsgPackSerializer.Serialize (System.Object obj, MsgPack.Packer packer) [0x0015e] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackSerializer.cs:108 
[     92203]   at CitizenFX.Core.MsgPackSerializer.Serialize (System.Object obj) [0x00020] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackSerializer.cs:55 
[     92203]   at CitizenFX.Core.Player.TriggerEvent (System.String eventName, System.Object[] args) [0x00000] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\Server\ServerWrappers.cs:41 
[     92218]   at CitizenFX.Core.BaseScript.TriggerClientEvent (CitizenFX.Core.Player player, System.String eventName, System.Object[] args) [0x00000] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\BaseScript.cs:117 
[     92218]   at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,ExoSVMain.Managers.SpawnManager,CitizenFX.Core.Player,string,object)
[     92234]   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) [0x0011e] in <48501e5f32e8491e924f8b8beae3e4f6>:0 
[     92234]   at (wrapper delegate-invoke) System.Action`5[System.Runtime.CompilerServices.CallSite,ExoSVMain.Managers.SpawnManager,CitizenFX.Core.Player,System.String,System.Object]:invoke_void_T1_T2_T3_T4_T5 (System.Runtime.CompilerServices.CallSite,ExoSVMain.Managers.SpawnManager,CitizenFX.Core.Player,string,object)
[     92250]   at ExoSVMain.Managers.SpawnManager.OnRequestSpawn (CitizenFX.Core.Player player) [0x0017f] in <239a8b3ab8c44e26a2a161ab368a28e1>:0 
[     92265]   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
[     92265]   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 <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92281]    --- End of inner exception stack trace ---
[     92281]   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 <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92296]   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92296]   at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92312]   at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92328]   at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 
[     92328]   at CitizenFX.Core.EventHandlerEntry+<Invoke>d__5.MoveNext () [0x00064] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\EventHandlerDictionary.cs:85 
[     92343] hitch warning: frame time of 908 milliseconds


#2

problem solved, passing vector in dynamic object result an error