{"record":{"id":"913ba9ba4eb92ced","repo":"peass-ng/PEASS-ng","slug":"dictionary-was-modified-after-this-collection-was","errorCode":null,"errorMessage":"Dictionary was modified after this collection was created.","messagePattern":"Dictionary was modified after this collection was created\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/YamlSerializer/RehashableDictionary.cs","lineNumber":417,"sourceCode":"            {\n                Dictionary = dictionary;\n                Dictionary.Added += DictionaryChanged;\n                Dictionary.Removed += DictionaryChanged;\n            }\n            public void Dispose()\n            {\n                Dictionary.Added -= DictionaryChanged;\n                Dictionary.Removed -= DictionaryChanged;\n            }\n            void DictionaryChanged(object sender, RehashableDictionary<K, V>.DictionaryEventArgs e)\n            {\n                Invalid = true;\n            }\n\n            protected void CheckValid()\n            {\n                if ( Invalid )\n                    throw new InvalidOperationException(\n                        \"Dictionary was modified after this collection was created.\");\n            }\n\n            static void ThrowReadOnlyError()\n            {\n                throw new InvalidOperationException(\"Collection is readonly.\");\n            }\n\n            #region ICollection<K> メンバ\n\n            public void Add(T item)\n            { ThrowReadOnlyError(); }\n\n            public void Clear()\n            { ThrowReadOnlyError(); }\n\n            public abstract bool Contains(T item);\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/YamlSerializer/RehashableDictionary.cs#L399-L435","documentation":"A fail-fast enumerator guard in RehashableDictionary's snapshot view: the view subscribes to the dictionary's Added/Removed events and sets Invalid on any change; CheckValid throws this InvalidOperationException when enumeration continues after the underlying dictionary was structurally modified — the same contract as .NET's Dictionary enumerator invalidation.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/YamlSerializer/RehashableDictionary.cs:417 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not add/remove entries while enumerating; finish or break the enumeration first","Copy entries to a list (ToList()) and iterate the copy when mutation is needed","Re-fetch the enumerator after any modification"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}