{"record":{"id":"1718777db9d1345f","repo":"stride3d/stride","slug":"game-window-context-not-supported-on-this-platform","errorCode":null,"errorMessage":"Game Window context not supported on this platform","messagePattern":"Game Window context not supported on this platform","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Games/GamePlatform.cs","lineNumber":122,"sourceCode":"        internal abstract GameWindow GetSupportedGameWindow(AppContextType type);\n\n        public virtual GameWindow CreateWindow(GameContext gameContext)\n        {\n            var window = GetSupportedGameWindow(gameContext.ContextType);\n            if (window != null)\n            {\n                window.Services = Services;\n\n                // Pass initial size\n                var requestedSize = new Int2(gameContext.RequestedWidth, gameContext.RequestedHeight);\n                window.PreferredWindowedSize = requestedSize;\n                window.PreferredFullscreenSize = requestedSize;\n\n                window.Initialize(gameContext);\n                return window;\n            }\n\n            throw new ArgumentException(\"Game Window context not supported on this platform\");\n        }\n\n        /// <summary>\n        /// If <c>true</c>, <see cref=\"Game.Run()\"/> is blocking until the game is exited, i.e. internal main loop is used.\n        /// If <c>false</c>, <see cref=\"Game.Run()\"/> returns immediately and the caller has to manage the main loop by invoking the <see cref=\"GameWindow.RunCallback\"/>.\n        /// </summary>\n        public bool IsBlockingRun { get; protected set; }\n\n        public void Run(GameContext gameContext)\n        {\n            IsBlockingRun = !gameContext.IsUserManagingRun;\n\n            gameWindow = CreateWindow(gameContext);\n\n            // Register on Activated\n            gameWindow.Activated += OnActivated;\n            gameWindow.Deactivated += OnDeactivated;\n            gameWindow.InitCallback = OnInitCallback;","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Games/GamePlatform.cs#L104-L140","documentation":"GamePlatform.CreateWindow receives a gameContext and matches it against supported window context types on the current platform. If the context type does not match any supported case, it throws this ArgumentException, i.e. a windowed context was requested where the platform cannot provide one.","triggerScenarios":"Calling Run with a GameContext whose type is not supported by the platform's GamePlatform implementation, e.g. passing a window context on a platform that only supports headless/offscreen contexts.","commonSituations":"Running Stride games on unsupported/custom platforms; passing a manually constructed GameContext of the wrong type; platform mismatch after switching target framework or backend.","solutions":["Use GameContextFactory to create a platform-appropriate context instead of constructing one manually","Verify the platform backend (e.g. SDL/desktop) that supports window contexts is available","Choose a headless/offscreen context if the platform cannot create windows"],"exampleFix":"// before\ngame.Run(new GameContext(headless)); // wrong type for desktop platform\n// after\ngame.Run(GameContextFactory.NewGameContext()); // auto-select supported context","handlingStrategy":"fallback","validationCode":"var ctx = GameContextFactory.NewGameContext(); // let factory pick a supported type","typeGuard":null,"tryCatchPattern":"try { game.Run(manualContext); } catch (ArgumentException ex) when (ex.Message.Contains(\"not supported on this platform\")) { game.Run(GameContextFactory.NewGameContext()); }","preventionTips":["Use GameContextFactory instead of hand-constructed contexts","Confirm the platform backend supports windowed contexts","Match context type to the active GamePlatform"],"tags":["platform","window","argument"],"backgroundTag":"unsupported-platform","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}