InvalidOperationException at LoadedError

Was working perfectly fine before today.

Now on load I get this each time.

 Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <c67de9d3cc9a41389412314b596e925a>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0028f] in <c67de9d3cc9a41389412314b596e925a>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0

EDIT: It reloaded fine.... Not sure why I was given the error before.

So it would be appreciated if someone could tell step by step how to actually make this work!!!!

Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.) at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in :0 at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in :0 at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in :0 at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in :0 at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0028f] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0

Merged post

k i dont know what i did but it was somehow fixed....

Was working just fine before today.

Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <3d0fd039ce6f422db1e228581afe3fd2>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0028f] in <3d0fd039ce6f422db1e228581afe3fd2>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0
(12:51:44) | Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(12:51:44) | Previous version of plugin failed to load: Rustcord

I get this error each time I try reloading the plugin now.

14:10 [Info] Rustcord was compiled successfully in 1719ms
14:10 [Info] Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
14:10 [Error] Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <eca6568baf244d8791244ebddb5d587b>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0028f] in <eca6568baf244d8791244ebddb5d587b>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0 
14:10 [Info] Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
14:10 [Info] Rolling back plugin to last good version: Rustcord
14:10 [Info] Loaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
14:10 [Warning] [Discord Ext] An error has occured: Response: An exception has occurred during the OnClose event.


Failed to call hook 'OnPlayerDisconnected' on plugin 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Ext.Discord.DiscordObjects.Channel.GetChannel (Oxide.Ext.Discord.DiscordClient client, System.String channelID, System.Action`1[T] callback) [0x00001] in <a5b2f558069e40f7b83de551a4df08a5>:0 
  at Oxide.Plugins.Rustcord+<OnPlayerDisconnected>c__AnonStorey2.<>m__0 (Oxide.Plugins.Rustcord+Settings+Channel ch) [0x00011] in <d46e0e43b123438e83a47fd20d46e85b>:0 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at Oxide.Plugins.Rustcord.OnPlayerDisconnected (BasePlayer player, System.String reason) [0x0004d] in <d46e0e43b123438e83a47fd20d46e85b>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00226] in <d46e0e43b123438e83a47fd20d46e85b>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0


o.version:

Protocol: 2153.176.1
Build Date: 03/08/2019 01:20:52
Unity Version: 2018.3.3f1
Changeset: 32894
Branch: release
Oxide.Rust Version: 2.0.4161

Plugin was downloaded here, no modify, its official file.

Rustcord.json:

{
  "Apikey":"mytbottoken",
  "Channels":[
    {
      "Channelid":"553610867208486912",
      "perms":[
        "cmd_allow",
        "cmd_players",
        "cmd_kick",
        "cmd_com",
        "p_connect",
        "p_disconnect",
        "p_death",
        "p_chat",
        "msg_serverinit"
      ]
    },
    {
      "Channelid":"553267895350722582",
      "perms":[
        "p_aconnect"
      ]
    },
    {
      "Channelid":"553611132942942209",
      "perms":[
        "p_report"
      ]
    }
  ],
  "Commandprefix":"!",
  "Commandroles":{
    "players":[
    ],
    "kick":[
      "Président",
      "Administrateur",
      "Staff Modération"
    ],
    "com":[
      "Président",
      "Administrateur"
    ]
  },
  "FilteredWord":"<censored>",
  "FilterWords":[
    "Word1",
    "Word2",
    "Word3"
  ]
}


Merged post

After a restart:
(15:56:15) | Rustcord was compiled successfully in 1720ms
(15:56:15) | Loaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(15:56:16) | Failed to run a 1.00 timer in 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.Rustcord.<Discord_Ready>m__2 () [0x00011] in <03f2d3f6ec85405bb23241dc8c07d63d>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <4452f821def6406d834e4149849fe7ea>:​

Is it please possible to update this plugin?
I get this error every day, but when reloaded it's fine on 2 of 3 servers. Think it has to do with setting up multiple channels in the config, the plugin does not like that somehow.

 

Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration
operation may not execute.)
at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <ac823
e2bb42b41bda67924a45a0173c3>:0 22kb/s in, 213kb/s out
at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <ac823e2bb42b41bda67924a45a0
173c3>:0
at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <ac823e2bb42b41bda67924a45a0173c
3>:0
at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <e7d6b5bcefdd4903b221ef0e9dce2abd>:0
at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0
028f] in <e7d6b5bcefdd4903b221ef0e9dce2abd>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x0
0079] in <9affce1cd15c4ec183941adef8db1722>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821d
ef6406d834e4149849fe7ea>:0
at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <

In response to StonerJezus ():
Is it please possible to update this plugin?
I get this error every day, but when reloaded it's...
bot is also disconnecting from discord every few hours.
same problem here

Rustcord - Failed to compile: Rustcord.cs(134,12): error CS0117: `Oxide.Plugins.Discord' does not contain a definition for `CloseClient'

In response to RazorRamon ():
same problem here
Rustcord - Failed to compile: Rustcord.cs(134,12): error CS0117: `Oxide.Plug...
That isn’t related to this thread at all, you just appear to be using the wrong Discord dependency.
Sorry Wulf.
i had the same issue like StonerJezuz, but lost the console output. i thought it´s the same usage.
In response to RazorRamon ():
Sorry Wulf.
i had the same issue like StonerJezuz, but lost the console output. i thought it´s...

for me it worked, but disconnected all the time. Found out that it was because I used 1 discord bot-id for 3 servers, what should not be a problem at first sight, but it can only handle a certain calls per minute or something, more trips out the api and makes the plugin crash.

try giving them all an own bot-id, and it should work fine.

The bot timing out it already a known issue with the dev.

Just use  Timed Execute to reload the plugin at any given time. It works fine for me.

An exception was thrown! (InvalidOperationException: Collection was modified; enumeration operation may not execute.) at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in :0 at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in :0 at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in :0 at System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00039] in <1b13ba6391c74847bbc3eddc86df7eee>:0 at Oxide.Ext.Discord.REST.Bucket.FireRequests () [0x0002f] in :0 at Oxide.Ext.Discord.REST.Bucket.RunThread () [0x0001f] in :0 at Oxide.Ext.Discord.REST.Bucket.<.ctor>b__27_0 () [0x00000] in :0 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0
Protocol: 2164.178.1
Build Date: 05/02/2019 18:10:16
Unity Version: 2018.3.3f1
Changeset: 34964
Branch: release
Oxide.Rust Version: 2.0.4200

 

| Failed to initialize plugin 'Rustcord v1.1.9' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <8aed936c607246cba73194242b5aa6f6>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00535] in <8aed936c607246cba73194242b5aa6f6>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0
(18:25:10) | Previous version of plugin failed to load: Rustcord
Again...

(14:20:26) | [DiscordExt] Invalid Session ID opcode recieved!
(14:22:53) | Failed to initialize plugin 'Rustcord v1.1.9' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <db92067ae0dd459f900d52a21191d0db>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00535] in <db92067ae0dd459f900d52a21191d0db>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0
(14:22:53) | Previous version of plugin failed to load: Rustcord​
(14:08:49) | Rustcord was compiled successfully in 2066ms

(14:08:49) | Unloaded plugin Rustcord v1.6.1 by Kirollos & OuTSMoKE

(14:08:49) | Failed to initialize plugin 'Rustcord v1.6.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)

at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <1f0c1ef1ad524c38bbc5536809c46b48>:0

at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <1f0c1ef1ad524c38bbc5536809c46b48>:0

at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <1f0c1ef1ad524c38bbc5536809c46b48>:0

at Oxide.Plugins.Rustcord.Loaded () [0x000a1] in <896b1293b94441d79b73045e8ac6e6e5>:0

at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00d90] in <896b1293b94441d79b73045e8ac6e6e5>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0

(14:08:49) | Unloaded plugin Rustcord v1.6.1 by Kirollos & OuTSMoKE

(14:08:49) | No previous version to rollback plugin: Rustcord