stride3d/stride · error · NotSupportedException

Current platform doesn't let you set the position of the…

Error message

Current platform doesn't let you set the position of the mouse cursor.

What it means

The SDL Application's MousePosition setter calls SDL.WarpMouseGlobal and throws NotSupportedException when SDL returns a non-zero error, i.e. the current platform/SDL build does not support warping the global mouse cursor position.

Solutions

  1. Avoid setting MousePosition on unsupported platforms; wrap in a platform capability check
  2. Run under X11 (or a session that supports global cursor warping) instead of Wayland
  3. Use window-relative SDL.WarpMouseInWindow if global positioning is not required

Example fix

// before
app.MousePosition = new Point(x, y);
// after
try { app.MousePosition = new Point(x, y); }
catch (NotSupportedException) { /* platform does not support global warp */ }
Defensive patterns

Strategy: try-catch

Validate before calling

// On Wayland or unsupported backends, skip global warp
bool canWarp = Environment.GetEnvironmentVariable("WAYLAND_DISPLAY") == null;

Try / catch

try { app.MousePosition = p; } catch (NotSupportedException) { /* fall back to window-relative warp */ }

Prevention

When it happens

Trigger: Setting Application.MousePosition on a platform where SDL.WarpMouseGlobal fails (returns != 0), such as Wayland or other backends without global cursor control.

Common situations: Running a Stride app under Wayland where global pointer warp is disallowed by the compositor, or on platforms whose SDL video driver lacks warp support.

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/d7ac3f4a5932744f. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/SDL/Application.cs:68

        /// </summary>
        public static Window WindowWithFocus { get; private set; }

        /// <summary>
        /// Screen coordinate of the mouse.
        /// </summary>
        public static Point MousePosition
        {
            get
            {
                int x, y;
                SDL.GetGlobalMouseState(&x, &y);
                return new Point(x, y);
            }
            set
            {
                int err = SDL.WarpMouseGlobal(value.X, value.Y);
                if (err != 0)
                    throw new NotSupportedException("Current platform doesn't let you set the position of the mouse cursor.");
            }
        }

        /// <summary>
        /// List of windows managed by the application.
        /// </summary>
        public static List<Window> Windows
        {
            get
            {
                lock (InternalWindows)
                {
                    var res = new List<Window>(InternalWindows.Count);
                    List<IntPtr> toRemove = null;
                    foreach (var weakRef in InternalWindows)
                    {
                        Window ctrl;
                        if (weakRef.Value.TryGetTarget(out ctrl))

View on GitHub (pinned to 96fad776d2)