stride3d/stride · critical · Exception

Cannot get Window information:

Error message

Cannot get Window information: 

What it means

After creating an SDL window, the Window constructor calls SDL_GetWindowWMInfo to obtain native window information (HWND, X11 Window, etc.). If that call returns false, the constructor throws a generic Exception including SDL.GetErrorS().

Solutions

  1. Read the appended SDL.GetErrorS() text for the SDL-level cause
  2. Ensure the SDL native library version matches the one the bindings were compiled against
  3. Verify the video driver is supported (X11/Win32/Cocoa) and properly initialized
  4. Retry after fixing SDL video subsystem initialization
Defensive patterns

Strategy: try-catch

Try / catch

try { var win = new Window(...); } catch (Exception ex) when (ex.Message.StartsWith("Cannot get Window information")) { log.Error(ex.Message); }

Prevention

When it happens

Trigger: SDL.GetWindowWMInfo fails for the freshly created window handle — typically an SDL/video-driver incompatibility or version mismatch between the SDL library and the WM-info struct layout.

Common situations: Mismatched SDL versions (struct versioning issue with SysWMInfo), unusual video drivers, or corrupted SDL state after a partially failed initialization.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Graphics/SDL/Window.cs:109

                sdlHandle = SDL.CreateWindowFrom(parentPtr);
            }
            else // no parent window
            {
                // Create the SDL window and then extract the native handle.
                sdlHandle = SDL.CreateWindow(title, Sdl.WindowposUndefined, Sdl.WindowposUndefined, 640, 480, (uint)flags);
            }
            

            if (sdlHandle == null)
            {
                throw new Exception("Cannot allocate SDL Window: " + SDL.GetErrorS()); 
            }

            SysWMInfo info = default;
            SDL.GetVersion(&info.Version);
            if (!SDL.GetWindowWMInfo(sdlHandle, &info))
            {
                throw new Exception("Cannot get Window information: " + SDL.GetErrorS());
            }

            if (Core.Platform.Type == Core.PlatformType.Windows)
            {
                Handle = info.Info.Win.Hwnd;
            }
            else if (Core.Platform.Type == Core.PlatformType.Linux)
            {
                Handle = (IntPtr)info.Info.X11.Window;
                Display = (IntPtr)info.Info.X11.Display;
            }
            else if (Core.Platform.Type == Core.PlatformType.Android)
            {
                Handle = (IntPtr)info.Info.Android.Window;
                Surface = (IntPtr)info.Info.Android.Surface;
            }
            else if (Core.Platform.Type == Core.PlatformType.macOS)
            {

View on GitHub (pinned to 96fad776d2)