Hi,
I thought I had the same problem as this post : [C#] TriggerClientEvent crashes resources intermittently, but unfortunately, I have the same problem.
Here’s the part of the code that gets the server to crash :
private async void buyVehicule([FromSource]Player player, int id_veh, int price)
(...)
else
{
Debug.WriteLine("test"); //<<<---- this is ok
TriggerClientEvent(player, "notif", "test1-2"); //<<<---- this is NOT ok
}
and on the client (lua file, other resource)
RegisterNetEvent('notif')
AddEventHandler('notif', function(msg)
sendnotif(msg)
end)
Here’s the console error :
InvokeNative: execution failed: No current resource manager.
Unhandled exception: System.ArgumentException: Value does not fall within the expected range.
Server stack trace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) [0x0000a] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at (wrapper cominterop) CitizenFX.Core.IScriptHost:InvokeNative (CitizenFX.Core.fxScriptContext&)
at (wrapper cominterop-invoke) CitizenFX.Core.IScriptHost:InvokeNative (CitizenFX.Core.fxScriptContext&)
at CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.InvokeNative (CitizenFX.Core.fxScriptContext& context) [0x00000] in /src/code/client/clrcore/MonoScriptRuntime.cs:242
at (wrapper remoting-invoke-with-check) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:InvokeNative (CitizenFX.Core.fxScriptContext&)
at (wrapper xdomain-dispatch) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:InvokeNative (object,byte[]&,byte[]&)
Exception rethrown at [0]:
at (wrapper xdomain-invoke) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:InvokeNative (CitizenFX.Core.fxScriptContext&)
at CitizenFX.Core.ScriptContext.InvokeInternal (System.UInt64 nativeIdentifier, CitizenFX.Core.IScriptHost scriptHost) [0x0000c] in /src/code/client/clrcore/ScriptContext.cs:173
at CitizenFX.Core.ScriptContext.Invoke (System.UInt64 nativeIdentifier, CitizenFX.Core.IScriptHost scriptHost) [0x00000] in /src/code/client/clrcore/ScriptContext.cs:166
at CitizenFX.Core.Native.Function.InvokeInternal (CitizenFX.Core.Native.Hash nativeHash, System.Type returnType, CitizenFX.Core.Native.InputArgument[] args) [0x00026] in /src/code/client/clrcore/Native.cs:28
at CitizenFX.Core.Native.Function.Call (CitizenFX.Core.Native.Hash hash, CitizenFX.Core.Native.InputArgument[] arguments) [0x00000] in /src/code/client/clrcore/Native.cs:16
at CitizenFX.Core.Player.TriggerEvent (System.String eventName, System.Object[] args) [0x0000f] in /src/code/client/clrcore/Server/ServerWrappers.cs:47
at vehShopSv.vehShopSv+<achatVehicule>d__6.MoveNext () [0x002ae] in <e73b5c81d55842b598be0d5c0cfa09b9>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_1 (System.Object state) [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
GlobalError: Unhandled exception in Mono script environment: System.ArgumentException: Value does not fall within the expected range.
...
And then the server crashes.
I’m working on VS2017, .NET4.5.2, I use the latest CitizenFX.Core.dll and the server runs on Ubuntu. It was restared, and the cache was cleared.
I also tried using player.TriggerEvent(“notif”,“blalba”), but same consequences…
Thank you in advance for your cooperation and pardon me if I’m in the wrong forum category.
Regards,