I just updated to the current MonoGame Version (22.214.171.1245) and now my game’s causing an exception on starting.
using (MyGame game = new MyGame()) game.Run();
Ein Ausnahmefehler des Typs “Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException” ist in MonoGame.Framework.dll aufgetreten.
Zusätzliche Informationen: Failed to create graphics device!
Unfortunately I can’t tell, which version I used before, but it was an Dev 3.6.0.x, I installed it in October or November last year.
In Game Constructor I do the following stuff on my GraphicsDeviceManager:
graphics = new GraphicsDeviceManager(this); graphics.HardwareModeSwitch = false; graphics.PreferMultiSampling = GameSettings.Graphics.MSAA;
Thanks for helping!
Can you provide more details of what platform/device the error is thrown on and project type.
Windows Project, running on Windows 10.
Graphics Card is NVIDIA gtx 970, Driver Version 378.66.
I just found out, that removing the line that assigns the PreferMultiSampling repairs the starting problem.
Yeah, there’s a bug with multisampling going on Sucks that it made it into the release.
Related issue https://github.com/MonoGame/MonoGame/issues/5449
Pull request that fixes it: https://github.com/MonoGame/MonoGame/pull/5477
I amended the title to include your MG version and as this is not yet solved I have marked it as resolved as it is identified but not fixed.
@Jjagg Good to know, even though it’s not good to have
I’ve just installed VS2017 and Monogame 3.6 onto a new laptop I’ve just got (first one, always use desktops) and I was getting the same sort of error message (never had the problem on my desktop pc).
I found this line in my code:
_graphics.PreferMultiSampling = true;
and removing it also made my app work as it should. Thanks for the heads up - though I can’t remember what this will do and why I put it to true in the first place
It shoudl enable MSAA and set the multisample count to the highest level supported by your GPU. You can still enable multisampling by setting the multisample count directly. For details see this post: Quick Overview: How to work with MSAA (DirectX too!)
Thanks for the refresher, been a while since I’ve done any MG stuff but like to keep the binaries on the machine just in case. Thanks for the link too!
Also ran into this bug. Just commented out the line
graphics.PreferMultiSampling = true;
in the Game1 constructor and it works.
This came up in some other topics. A fix for this bug was recently merged and will be included in the 3.6.1 release.
I’ve just built MonoGame starting from the code as October 5th, 2017, and I still get the exception if I don’t comment out
GraphicsDeviceManager.PreferMultiSampling = true;
Have you tried setting it to false?
Setting it to false works, but setting it to false is not what I want.
What project type are you using?
I’m using a Windows C# project type.
Debugging a bit I see that the exception is generated by
_swapChain = new SwapChain(dxgiFactory, dxgiDevice, desc);
The same line passes well up to commits dated mid January 2017.
Digging further I found out that with commits before January 2017 in above SwapChain call desc.SampleDescription.Count is 8 and desc.SampleDescription.Quality is 16, while with later commits such values are 32 and -1. By replacing a 32 with an 8 in line
presentationParameters.MultiSampleCount = GraphicsDevice != null
of GraphicsDevice.DirectX.cs and in line
private const int MultiSampleCountLimit = 32;
of GraphicsCapabilities.cs I get desc.SampleDescription.Count = 8 and desc.SampleDescription.Quality = 16 and no crash.
Note that the line of GraphicsDevice.DirectX.cs is executed twice before the call to SwapChain(), and both times GraphicsDevice is null, so that the fixed limit is selected without checking the capabilities of the platform.
I hope this helps to define how to proceed. By the moment I proceed with above lines changed.
What version of MG are you using? I can’t reproduce this on latest develop.
I’ve used the 5 ott 2017, 22:10 version.