Hey guys, im working with language C# and Send NUI message, but apparently this is giving errors, and i can’t even send to JS, when i join on server, thats starts spamming console of client, and the debug is not helping me too, says the error on Main in x line, but its nothing… Someone can help me? I can provide all informations necessary to solve this problem. Thanks.
Might help if you post your code and the error
Here go, the screenshot of code and error message.
Image
And error:
[ 3521375] [ GTAProcess] MainThrd/
[ 3521375] [ GTAProcess] MainThrd/ Failed to run a tick for Main: System.BadImageFormatException: Error verifying Saphirex.Core.Vehicle.Client.Main/d__7:MoveNext (): Cannot load method from token 0x0a00005e for call at 0x023a[ 3521375] [ GTAProcess] MainThrd/ at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521375] [ GTAProcess] MainThrd/ at Saphirex.Core.Vehicle.Client.Main.OnTick () [0x00026] in <7ad9282a471e4d58a4c33526da9e5523>:0
[ 3521375] [ GTAProcess] MainThrd/ at CitizenFX.Core.BaseScript+<>c__DisplayClass30_1.b__1 () [0x00030] in C:\gl\builds\edf06b9b\0\cfx\fivem\code\client\clrcore\BaseScript.cs:114
[ 3521375] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521375] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task.Execute () [0x00010] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521391] [ GTAProcess] MainThrd/
[ 3521391] [ GTAProcess] MainThrd/ Exception thrown by a task: System.AggregateException: One or more errors occurred. —> System.BadImageFormatException: Error verifying Saphirex.Core.Vehicle.Client.Main/d__7:MoveNext (): Cannot load method from token 0x0a00005e for call at 0x023a[ 3521391] [ GTAProcess] MainThrd/ at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521391] [ GTAProcess] MainThrd/ at Saphirex.Core.Vehicle.Client.Main.OnTick () [0x00026] in <7ad9282a471e4d58a4c33526da9e5523>:0
[ 3521391] [ GTAProcess] MainThrd/ at CitizenFX.Core.BaseScript+<>c__DisplayClass30_1.b__1 () [0x00030] in C:\gl\builds\edf06b9b\0\cfx\fivem\code\client\clrcore\BaseScript.cs:114
[ 3521391] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521391] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task.Execute () [0x00010] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521391] [ GTAProcess] MainThrd/ — End of inner exception stack trace —
[ 3521391] [ GTAProcess] MainThrd/ —> (Inner Exception #0) System.BadImageFormatException: Error verifying Saphirex.Core.Vehicle.Client.Main/d__7:MoveNext (): Cannot load method from token 0x0a00005e for call at 0x023a
[ 3521406] [ GTAProcess] MainThrd/ at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521406] [ GTAProcess] MainThrd/ at Saphirex.Core.Vehicle.Client.Main.OnTick () [0x00026] in <7ad9282a471e4d58a4c33526da9e5523>:0
[ 3521406] [ GTAProcess] MainThrd/ at CitizenFX.Core.BaseScript+<>c__DisplayClass30_1.b__1 () [0x00030] in C:\gl\builds\edf06b9b\0\cfx\fivem\code\client\clrcore\BaseScript.cs:114
[ 3521406] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <74fbbe963b7e417b8d715b858c5c584f>:0
[ 3521406] [ GTAProcess] MainThrd/ at System.Threading.Tasks.Task.Execute () [0x00010] in <74fbbe963b7e417b8d715b858c5c584f>:0 <—
And im using Newtonsoft.Json from Nuget.
Solved problem, we need to use Newtonsoft.Json.dll PLC (Portable Library Class).