1 year ago
#355055
Sebry
"Microsoft.Xna.Framework.Graphics.GraphicsDevice.GraphicsDevice" giving me AccessViolationException
So, recently I was following a tutorial on how to make a game with FNA in Visual Studio. Everything worked fine until I added these four lines of code (in cs):
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
graphics.IsFullScreen = false;
graphics.ApplyChanges();
Now, whenever I launch the game it gives me this error (it can be a little bit different than the one I get because I had to translate some parts of it):
This exception was originally thrown on this call stack:
Microsoft.Xna.Framework.Graphics.GraphicsDevice.GraphicsDevice (Microsoft.Xna.Framework.Graphics.GraphicsAdapter, Microsoft.Xna.Framework.Graphics.GraphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters)
Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice ()
Microsoft.Xna.Framework.Game.DoInitialize ()
Microsoft.Xna.Framework.Game.Run ()
GameEngine.Program.Main (string []) in Program.cs
I searched the whole internet about this, and there is no solution so far. Also, for some reason it DOES work in VSC, tho I would like to do it in VS (actually, I used the NuGet package in VSC so that might be the solution, but all the code that I'm actually using is the same).
If that somehow helps you with the solution, here is the series I was following, and I got stuck on part two: https://www.youtube.com/playlist?list=PL3wErD7ZIp_DtsTKoouVCxu81UQkI9VZL
Thanks for any help!
c#
xna
access-violation
0 Answers
Your Answer