15:06:30 [EROR] (cssharp:Core) Error invoking callback…
- User
15:06:30 [EROR] (cssharp:Core) Error invoking callback System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.Dictionary
2.Enumerator.MoveNext() at SpawnProp.SpawnProp.EventRoundStart(EventRoundStart event, GameEventInfo info) in C:\Users\zoro8\RiderProjects\SpawnProp\SpawnProp\SpawnProp.cs:line 91 at InvokeStub_GameEventHandler1.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.b__18_0(fxScriptContext* context) in E:\plugins\managed\CounterStrikeSharp.API\Core\FunctionReference.cs:line 100В чем ошибка?
- Assistant
Ошибка, которую вы наблюдаете, связана с тем, что коллекция (например,
DictionaryилиList) была изменена во время ее перечисления. В вашем стеке вызовов ошибка возникает на строке 91 в файлеSpawnProp.cs, внутри методаEventRoundStart.Когда вы выполняете перечисление коллекции, изменение ее структуры (добавление или удаление элементов) не допустимо и вызывает исключение