{"record":{"id":"c80c4920c5ef9950","repo":"stride3d/stride","slug":"not-initialized","errorCode":null,"errorMessage":"Not initialized.","messagePattern":"Not initialized\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Games/GameSystemCollection.cs","lineNumber":149,"sourceCode":"                        {\n                            drawable.Key.Draw(gameTime);\n                            drawable.Key.EndDraw();\n                        }\n                    }\n                }\n            }\n\n            currentlyDrawingGameSystems.Clear();\n        }\n\n        /// <summary>\n        /// Loads the content.\n        /// </summary>\n        public virtual void LoadContent()\n        {\n            if (State != GameSystemState.Initialized)\n            {\n                throw new InvalidOperationException(\"Not initialized.\");\n            }\n\n            State = GameSystemState.ContentLoaded;\n\n            lock (contentableGameSystems)\n            {\n                foreach (var contentable in contentableGameSystems)\n                {\n                    currentlyContentGameSystems.Add(contentable);\n                }\n            }\n\n            foreach (var contentable in currentlyContentGameSystems)\n            {\n                using (var profile = Profiler.Begin(GameProfilingKeys.GameSystemLoadContent, GetGameSystemName(contentable)))\n                    contentable.LoadContent();\n            }\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Games/GameSystemCollection.cs#L131-L167","documentation":"GameSystemCollection.LoadContent requires the collection to be in the Initialized state; it throws this InvalidOperationException if content is loaded in any other state. This enforces the GameSystem lifecycle: Initialize -> LoadContent -> (Update/Draw).","triggerScenarios":"Calling LoadContent() before Initialize(), after content was already unloaded (state back to Initialized handled elsewhere), or calling it twice without an UnloadContent in between where state already advanced past Initialized.","commonSituations":"Manually driving the game-system lifecycle out of order in tests or custom hosts; calling LoadContent in a constructor; forgetting Initialize before LoadContent in a custom loop.","solutions":["Call Initialize() before LoadContent() and only once per lifecycle stage","Check the State property before calling LoadContent","Let GameBase drive the lifecycle automatically instead of calling methods manually"],"exampleFix":"// before\nsystems.LoadContent();\nsystems.Initialize();\n// after\nsystems.Initialize();\nsystems.LoadContent();","handlingStrategy":"validation","validationCode":"if (systems.State == GameSystemState.Initialized) systems.LoadContent();","typeGuard":null,"tryCatchPattern":"try { systems.LoadContent(); } catch (InvalidOperationException ex) when (ex.Message == \"Not initialized.\") { systems.Initialize(); systems.LoadContent(); }","preventionTips":["Always Initialize before LoadContent","Let GameBase drive the game-system lifecycle","Check State before manual lifecycle calls"],"tags":["lifecycle","game-systems","invalid-state"],"backgroundTag":"invalid-state-transition","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"}