stride3d / stride3d/stride

[Engine] Calling game.Exit() in a game running in Fullscreen mode causes an unhandled exception error on exit.

Open
#2,008 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: Official Release

Version: 4.1.0.1948

Platform(s): Windows

Describe the bug
Calling game.Exit() in a game running in Fullscreen mode causes an unhandled exception error on exit. It appears the render device is resetting back to it's default windowed resolution on exit of fullscreen, and is trying to reload assets which have been unloaded by the game as it exited.

To Reproduce
Steps to reproduce the behavior:

  1. Set game.Window.PreferredFullscreenSize to a size different to windowed resolution. I use:

         GraphicsOutput[] array = game.GraphicsDevice.Adapter.Outputs;
         game.Window.PreferredFullscreenSize = new Int2(array[0].CurrentDisplayMode.Height, array[0].CurrentDisplayMode.Width);
    
  2. Set game.Window.IsFullscreen = true;

  3. Call game.Exit()

Expected behavior
Game to exit silently and successfully.

Screenshots
SameErrorOtherGame

Log and callstacks
N/A

Additional context
I have a simple project available which shows this issue here - SimpleFullscreenCrashTest.zip.

I have confirmed the issue using both normal fullscreen and 'FullscreenIsBorderlessWindow'. Issue occurs whether you run from editor, Visual Studio or from a build file directly.

I upgraded a game from 4.0 which did not have this issue to the version 4.1.0.1948, and am now experiencing this in that game. I also have a game that has only had this issue since upgrading to 4.1.0.1948 from the previous patch suggesting this is a new issue in 4.1.0.1948

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided SimpleFullscreenCrashTest project on Windows and reproduce the failure by setting game.Window.PreferredFullscreenSize, enabling game.Window.IsFullscreen, and calling game.Exit(). Trace the fullscreen render-device reset and shutdown path; done means the game exits silently without an unhandled exception in both normal and borderless fullscreen modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics, game-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.