oylsister / ZombieSharp

Infection/survival style gameplay for CS2 in C#
GNU General Public License v3.0
43 stars 9 forks source link

[BUG] Error invoking callback #40

Open csportalsk opened 3 weeks ago

csportalsk commented 3 weeks ago

Same errors with default model players or workshop models player. Tested with 9 bots.

[EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: An item with the same key has already been added. Key: 1
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at ZombieSharp.ZombieSharp.InitialClientData(CCSPlayerController player) in E:\Github\ZombieSharp\ZombieSharp\EventModule.cs:line 45
   at ZombieSharp.ZombieSharp.OnClientPutInServer(Int32 client) in E:\Github\ZombieSharp\ZombieSharp\EventModule.cs:line 38
   at InvokeStub_OnClientPutInServer.Invoke(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.BasePlugin.<>c__DisplayClass51_0`1.<RegisterListener>b__2(ScriptContext context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/BasePlugin.cs:line 297
   at InvokeStub_Action`1.Invoke(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context)
[EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Entity is not valid
   at CounterStrikeSharp.API.Guard.IsValidEntity(CEntityInstance ent) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Guard.cs:line 8
   at CounterStrikeSharp.API.Core.CCSPlayerController.SwitchTeam(CsTeam team) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs:line 152
   at ZombieSharp.ZombieSharp.HumanizeClient(CCSPlayerController client, Boolean force) in E:\Github\ZombieSharp\ZombieSharp\ZombieSharp.cs:line 287
   at ZombieSharp.ZombieSharp.<>c__DisplayClass34_0.<OnPlayerSpawn>b__0() in E:\Github\ZombieSharp\ZombieSharp\EventModule.cs:line 347
   at InvokeStub_Action.Invoke(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 100

[#2:LOADED]: "Zombie Sharp" (1.2.1) by Oylsister, Kurumi, Sparky Current API Version: v259 (1.0.259+28ce183) Metamod:Source version 2.0.0-dev+1313

oylsister commented 3 weeks ago

is this server Windows or Linux?

The issue with bot is very common here since they're so much pain to deal with it. I suggest that to test it with the actual player rather than bot.

csportalsk commented 3 weeks ago

Linux server.

csportalsk commented 3 weeks ago

I tried server alone with no bots. Still error. @oylsister

[EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at ZombieSharp.ZombieSharp.GetGameRules() in E:\Github\ZombieSharp\ZombieSharp\ZombieSharp.cs:line 484
   at ZombieSharp.ZombieSharp.OnRoundStart(EventRoundStart event, GameEventInfo info) in E:\Github\ZombieSharp\ZombieSharp\EventModule.cs:line 140
   at InvokeStub_GameEventHandler`1.Invoke(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 100
oylsister commented 3 weeks ago

I think the latest change in CSSharp has also changed hl2sdk. You could try recompiling plugin with the latest Api instead. https://www.youtube.com/watch?v=wCLKUO0xj38

csportalsk commented 3 weeks ago

I recompiled ZombieSharp and ZombieSharpAPI with CSSharp v259 and still same errors.

oylsister commented 4 days ago

Did you test this during warmup round? and did you enable infection during warmup?