[RESOLVED] Run() causes: No Suitable Graphics Device Exception - Failed to create graphics device (

Can you check that GraphicsCapabilities.MaxMultiSampleCount is properly initialized and that the ms count is clamped to that value when the GraphicsDevice is being created here?

The first execution of

presentationParameters.MultiSampleCount = GraphicsDevice != null
? GraphicsDevice.GraphicsCapabilities.MaxMultiSampleCount
: 32;

within GraphicsDevice.DirectX.cs occurs in Initialize() within CreateDevice(). GraphicsDevice is null there.
The second execution of such lines occurs in

         var gdi = DoPreparingDeviceSettings();

and therefore again before


that is before the creation of GraphicsDevice.

Instead PresentationParameters.MultiSampleCount should be set after the creation of GraphicsDevice and after PlatformInitializeAfterResources(GraphicsDevice device) , that computes MaxMultiSampleCount, I believe.

Sorry for having overlooked your last post of yesterday, but it crossed with my post.
Thanks for your attention.
The point is exactly this: GetMaxMultiSampleCount(GraphicsDevice device) is called byPlatformInitializeAfterResources(GraphicsDevice device) which is called by InitializeAfterResources(GraphicsDevice device) within GraphicsCapabilities.cs which is called by Initialize() within GraphicsDevice.cs. However within Initialize() the call to InitializeAfterResources is preceded by a call to PlatformInitialize(). Within PlatformInitialize there is the creation of _swapChain basing on PresentationParameters.MultiSampleCount which does not yet have the correct value. Therefore the exception.
In fact I did some code chunk switching (modifying the order of operations) and got a working version (only for Windows).
Probably the exception does not occur often because usually platforms accept PresentationParameters.MultiSampleCount = 32, which is the default value. I however have a Notebook that has some year, and it accepts as a maximum only PresentationParameters.MultiSampleCount = 8.
You probably can get the exception too if you replace 32 with a higher value that your platform can’t support within
private const int MultiSampleCountLimit = 32;
in GraphicsCapabilities.cs
and within
presentationParameters.MultiSampleCount = GraphicsDevice != null
? GraphicsDevice.GraphicsCapabilities.MaxMultiSampleCount
: 32;
in GraphicsDeviceManager.cs.
So I think the code should be revisited.

Make sure you’re using a recent build. This was fixed in https://github.com/MonoGame/MonoGame/pull/5477
Develop no longer has the code you’re referring to.

I’m getting a unit test failure with max multisample count with latest develop branch since I upgraded my graphics card. May be related to this as well. Haven’t diagnosed the issue yet.

In effect I believed I was using the development branch, but it wasn’t so. I’m quite new in the git world.
Now that I’m using the real development branch I don’t get any more that exception.
Jjagg, thank you very much for your support and sorry for the time you spent on this non-issue.

I get another exception later during game loading, but if necessary I’ll open a new topic for that.

1 Like

Trying to use Monogame (ver 3.7.1) in Visual Studio 2019.
Using Windows 10, Intel G45/43 chipset (it’s an old chip, I know, but it’s updated to newest version).

Everything works out okay (found templates, can build game), UNTIL I go to actually Start the game on my PC (and have the game window appear); then I’m getting the error that it ‘failed to create graphics device.’ I can successfully build the project but can’t launch the game window.

I am unable to find any line that mentions ‘multisampling’ or anything like that in my Game.cs file (or elsewhere within the project), otherwise I’d just comment it out.

EDIT: 1/17/20

Hmm, this is how I fixed this problem.

Running: Windows 10, with integrated graphics card (Intel G45/G43), Visual Studio 19, Monogame 3.7.1

Project Structure: Solution(from blank solution) > Game.Shared, Game.Android, Game.OpenGL (followed this guide on creating a Cross-Platform project, method number 3, where before I only had 1 Cross Platform Desktop project, Shared project is the main project ).

I simply commented out the 'using Microsoft.Xna.Framework.Storage;" line and the app will build and deploy to an Android device.**

I have been unable to get the game to launch to android device AND load content. I can launch it WITHOUT content (by commenting out the line), or I can build it with content BUT can’t deploy to a device. I don’t have any references to XNA libraries on any of my projects.
No nuGet’s installed. I will gladly send a .zip of my project if anyone wants the whole code.