{"record":{"id":"93e42d6482fb3de9","repo":"stride3d/stride","slug":"internal-error-the-collection-has-already-muted-to-a","errorCode":null,"errorMessage":"Internal error, the collection has already muted to a dictionary.","messagePattern":"Internal error, the collection has already muted to a dictionary\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"sources/core/Stride.Core.Design/Collections/HybridDictionary.cs","lineNumber":339,"sourceCode":"        if (list != null)\n        {\n            if (list.Count + 1 < CutoverPoint)\n            {\n                list.Add(item);\n                return;\n            }\n            else\n            {\n                ChangeOver();\n            }\n        }\n        dictionary!.Add(item.Key, item.Value);\n    }\n\n    private void ChangeOver()\n    {\n        if (list == null)\n            throw new InvalidOperationException(\"Internal error, the collection has already muted to a dictionary.\");\n\n        dictionary = new Dictionary<TKey, TValue>(InitialDictionarySize, keyComparer);\n        foreach (var item in list)\n        {\n            dictionary.Add(item.Key, item.Value);\n        }\n        list = null;\n    }\n}\n","sourceCodeStart":321,"sourceCodeEnd":349,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Design/Collections/HybridDictionary.cs#L321-L349","documentation":"The private ChangeOver method converts the internal list storage to a Dictionary; it throws InvalidOperationException if the transition already happened (list is null). This is an internal invariant guard — user code should never trigger it directly; hitting it indicates a bug or misuse via reflection.","triggerScenarios":"Only reachable if ChangeOver is invoked after the collection already cut over to dictionary mode — an internal invariant violation, not a normal usage error.","commonSituations":"Practically never hit by library users; would indicate corrupted internal state, a race between threads mutating the collection, or reflection-based misuse.","solutions":["Report as a bug if hit through normal public API usage","Avoid concurrent mutation of the HybridDictionary from multiple threads without synchronization","Do not call private members via reflection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { collection.Add(kvp); }\ncatch (InvalidOperationException) { /* internal invariant bug — report */ }","preventionTips":["Do not mutate HybridDictionary concurrently from multiple threads without synchronization","Never call private members via reflection"],"tags":["csharp","collections","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}