stride3d/stride · error · InvalidOperationException

No compatible screen mode found

Error message

No compatible screen mode found

What it means

In FindBestDevice, when no device was found but the graphics profiles ARE supported, Stride concludes the hardware can run the profile but no screen mode/device configuration matched, and throws 'No compatible screen mode found'. This distinguishes a capability problem (1152) from a display-mode/mode-matching problem.

Solutions

  1. Set PreferredBackBufferWidth/Height to a standard resolution supported by the monitor, or leave defaults instead of forcing exotic sizes.
  2. Avoid forcing fullscreen during initialization; start windowed and switch to fullscreen after the device is created.
  3. Verify a display is attached and enumeration works (real monitor, not headless server); retry with default GraphicsDeviceManager settings.

Example fix

// before
gdm.PreferredBackBufferWidth = 1366; // unsupported mode
gdm.IsFullScreen = true;
// after
gdm.PreferredBackBufferWidth = 1920;
gdm.PreferredBackBufferHeight = 1080;
gdm.IsFullScreen = false;
Defensive patterns

Strategy: validation

Validate before calling

if (gdm.IsFullScreen)
{
    var mode = GraphicsDevice.QueryScreenResolutions().FirstOrDefault(r =>
        r.Width == gdm.PreferredBackBufferWidth && r.Height == gdm.PreferredBackBufferHeight);
    if (mode == null) gdm.IsFullScreen = false; // fall back to windowed
}

Try / catch

try { game.Run(); }
catch (InvalidOperationException ex) when (ex.Message == "No compatible screen mode found")
{
    gdm.IsFullScreen = false;
    gdm.PreferredBackBufferWidth = gdm.PreferredBackBufferHeight = 0; // defaults
    game.Run();
}

Prevention

When it happens

Trigger: FindBestDevice fails to produce a GraphicsDeviceInformation even though IsPreferredProfileAvailable returns true — e.g. requested resolution/refresh/backbuffer format or device settings match no available screen mode during device enumeration.

Common situations: Requesting a fullscreen resolution the monitor doesn't offer, unusual PreferredBackBufferWidth/Height combinations, multi-monitor setups with odd mode lists, or headless systems where no real display mode exists.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Games/GraphicsDeviceManager.cs:689

                preferredParameters.PreferredBackBufferWidth = resizedBackBufferWidth;
                preferredParameters.PreferredBackBufferHeight = resizedBackBufferHeight;
            }

            var devices = graphicsDeviceFactory.FindBestDevices(preferredParameters);
            if (devices.Count == 0)
            {
                // Nothing was found; first, let's check if graphics profile was actually supported
                // NOTE: We don't do this preemptively because in some cases it seems to take lot of time
                //       (happened on a test machine, several seconds freeze on ID3D11Device.Release())
                if (!IsPreferredProfileAvailable(preferredParameters.PreferredGraphicsProfile, out var availableGraphicsProfile))
                {
                    var notSupportedProfiles = string.Join(", ", preferredParameters.PreferredGraphicsProfile);
                    throw new InvalidOperationException($"None of the graphics profiles [{notSupportedProfiles}] are supported by the Graphics Device. " +
                        $"The highest available profile is [{availableGraphicsProfile}].");
                }

                // Otherwise, there was just no screen mode
                throw new InvalidOperationException("No compatible screen mode found");
            }

            RankDevices(devices);

            if (devices.Count == 0)
            {
                throw new InvalidOperationException("No compatible screen modes found after ranking");
            }
            return devices[0];
        }

        /// <summary>
        ///   Ranks a list of <see cref="GraphicsDeviceInformation"/>s before creating a new Graphics Device.
        /// </summary>
        /// <param name="foundDevices">A list of possible device configurations to be ranked and reordered.</param>
        protected virtual void RankDevices(List<GraphicsDeviceInformation> foundDevices)
        {
            // Don't sort if there is a single device (mostly for XAML/UWP)

View on GitHub (pinned to 96fad776d2)