stride3d/stride · error · ArgumentException

Game Window context not supported on this platform

Error message

Game Window context not supported on this platform

What it means

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.

Solutions

  1. Use GameContextFactory to create a platform-appropriate context instead of constructing one manually
  2. Verify the platform backend (e.g. SDL/desktop) that supports window contexts is available
  3. Choose a headless/offscreen context if the platform cannot create windows

Example fix

// before
game.Run(new GameContext(headless)); // wrong type for desktop platform
// after
game.Run(GameContextFactory.NewGameContext()); // auto-select supported context
Defensive patterns

Strategy: fallback

Validate before calling

var ctx = GameContextFactory.NewGameContext(); // let factory pick a supported type

Try / catch

try { game.Run(manualContext); } catch (ArgumentException ex) when (ex.Message.Contains("not supported on this platform")) { game.Run(GameContextFactory.NewGameContext()); }

Prevention

When it happens

Trigger: 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.

Common situations: Running Stride games on unsupported/custom platforms; passing a manually constructed GameContext of the wrong type; platform mismatch after switching target framework or backend.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/1718777db9d1345f. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Games/GamePlatform.cs:122

        internal abstract GameWindow GetSupportedGameWindow(AppContextType type);

        public virtual GameWindow CreateWindow(GameContext gameContext)
        {
            var window = GetSupportedGameWindow(gameContext.ContextType);
            if (window != null)
            {
                window.Services = Services;

                // Pass initial size
                var requestedSize = new Int2(gameContext.RequestedWidth, gameContext.RequestedHeight);
                window.PreferredWindowedSize = requestedSize;
                window.PreferredFullscreenSize = requestedSize;

                window.Initialize(gameContext);
                return window;
            }

            throw new ArgumentException("Game Window context not supported on this platform");
        }

        /// <summary>
        /// If <c>true</c>, <see cref="Game.Run()"/> is blocking until the game is exited, i.e. internal main loop is used.
        /// 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"/>.
        /// </summary>
        public bool IsBlockingRun { get; protected set; }

        public void Run(GameContext gameContext)
        {
            IsBlockingRun = !gameContext.IsUserManagingRun;

            gameWindow = CreateWindow(gameContext);

            // Register on Activated
            gameWindow.Activated += OnActivated;
            gameWindow.Deactivated += OnDeactivated;
            gameWindow.InitCallback = OnInitCallback;

View on GitHub (pinned to 96fad776d2)