XNA blues

Started by
6 comments, last by Bromordra 14 years, 9 months ago
I've been having nothing but problems since I decided to try my hand at XNA. First off, when I finally got Visual C# to load up and got all the neccessary prereqs (DirectX updates and runtimes, XNA updates and runtimes, .NET Frameworks, ect.) I got this bizzare error stating that I was missing some .dll. After about 6 hours of searching the internet, downloading 'fixes' that did nothing for me, I finally learn that it's fixed by simply disabling the manifest. Sadly, that's no where near the worst. Now, what I'm trying to do is do a Pong clone first off. But I seem to have a problem with rendering sprites or textures of any kind. Any program I code with the line
 sprite = Content.Load<Texture2D>("Sprite"); 
in it automatically crashes before a window even shows. The really bizzare thing is that I downloaded a tutorial source code from microsoft on how to draw a sprite, and when I ran it it ran perfectly. So I decided to copy/paste the entirety of that demo's code into a new project, but replace it's image with my own, to see if maybe it was my sprite's fault somehow. Crashed. Next I copied the tutorial's own sprite to my new program, which is now essentially the tutorial with a different title. Surely this won't crash, right? Wrong. No matter what I do, it seems that anything I make myself, even if it's straight copy/pasting, crashes as long as I attempt to draw any kind of sprite. Does anyone have any idea what's wrong with me? This is way too bizarre and frustrating for me. Please help. EDIT: Forgot to mention, using XNA 3.1 with Visual Studio 2008 on Windows Vista 64-bit. All neccessary updates and such are already installed (I think . . . ).
Advertisement
Do you run it in the debugger?
You should see what exception caused it to crash in the debug output window. Probably something wrong with how you add your sprite image to the content.. could be that it isn't found or that the settings for it are different or something.
Trouble installing Visual Studio? DLLs missing in a Visual Studio install? Downloading "fixes" from the internet?
You should really think about an OS reinstall by now. Maybe try Windows 7 RC, it's really smooth.

I chose C#/XNA precisely because setting up a development system is so dead easy. You don't have to walk people through setting up the Windows SDK paths, making sure the DLL runtime is selected, recompiling 3rd party DLLs to make sure they don't suddenly need two different versions of the VC runtime... now it's just install VC# Express, install XNA, done.

You sound a little bit as if, instead of investigating what you're doing wrong, you're just raising your frustration level and put the blame on the tools. Sorry if this isn't true, but this is how it sounds from here ;)


Anyway, back on topic:

- Make sure you added to project within the 'Content' subproject. Otherwise, the files won't be processed by the content pipeline and not copied into your project's output folder.

- The path matters, too. If you create a folder in your 'Content' project named "sprites" and add the file there, you'll have to load it as content.Load<Sprite>("sprites/Sprite")

- Your project wouldn't crash but throw an unhandled exception, containing an error message that indicates what exactly went wrong (which will be shown in the exception window when you run your project in the debugger). If it does indeed crash (access violation or worse), then something's very wrong with your system.

Without further details (error message, zipped example project, whatever) it's hard to tell where exactly the error is.
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Quote:Original post by Cygon
Trouble installing Visual Studio? DLLs missing in a Visual Studio install? Downloading "fixes" from the internet?
You should really think about an OS reinstall by now. Maybe try Windows 7 RC, it's really smooth.


Yeah, actually I began considering that just after I posted here. Probably going to switch to either XP or 7 today, as soon as I back up all my stuff.

Quote:

I chose C#/XNA precisely because setting up a development system is so dead easy. You don't have to walk people through setting up the Windows SDK paths, making sure the DLL runtime is selected, recompiling 3rd party DLLs to make sure they don't suddenly need two different versions of the VC runtime... now it's just install VC# Express, install XNA, done.

You sound a little bit as if, instead of investigating what you're doing wrong, you're just raising your frustration level and put the blame on the tools. Sorry if this isn't true, but this is how it sounds from here ;)

I can guarantee you that this is not a user error on any level. I slaved away at this for hours making sure every last character in my code was right. You are correct about the frustration level though, I had several shouting matches with my screen over this. Believe me, I blamed by self long before the tools, but I kind've eliminated that possibility as far as I can see, so it must be the tools.

Quote:
Anyway, back on topic:

- Make sure you added to project within the 'Content' subproject. Otherwise, the files won't be processed by the content pipeline and not copied into your project's output folder.

- The path matters, too. If you create a folder in your 'Content' project named "sprites" and add the file there, you'll have to load it as content.Load<Sprite>("sprites/Sprite")

Yeah, I made that mistake on my first attempt at it, but I fixed it, and still it won't work

Quote:
- Your project wouldn't crash but throw an unhandled exception, containing an error message that indicates what exactly went wrong (which will be shown in the exception window when you run your project in the debugger). If it does indeed crash (access violation or worse), then something's very wrong with your system.


I didn't get any error messages, at least not that I saw. I just got a small window saying "Pong3.1 has Stopped Working" (pong3.1 being my game)like when any program crashes on Vista.


Rate++. You're one of the few cool guys who responds well to criticism. Keep that trait :) :)

Strange stuff. That error dialog should only come up if you ran the .exe on a system that doesn't even have a debugger installed.

Can you put a breakpoint right before the content.Load<>() line and check whether the debugger breaks there?

To see the error message despite this, you could put a try...catch around your Main() method. Not the nicest way of debugging, but maybe it at least gets you a step further:

try {  using(MyGame game = new MyGame()) {    game.Run();  }}catch(Exception e) {  System.Windows.Forms.MessageBox.Show("Error: " + e.Message);}

Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Thanks for the suggestion Cygon, but In my attempts to back things up for chaning away from Vista, I kind of broke Visual Studio. So I'm going to have to wait until 7 is downloaded and installed to try that (that is if OS changing somehow doesn't fix it)
Visual Studio seems to be a good indicator of there being a problem with your Windows installation. I had a Dell machine with pre-installed Windows where Visual Studio 2008 would flatly refuse to install, and another where I'd get odd missing service messages or form designers failing to start. In both cases I fixed the issue by installing Windows myself, and have yet to have any more problems.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Just finished the transition to Win7 and I am as giddy as a schoolgirl. C# and XNA work fine, my computer is zipping along at a fantastic clip and all is right with the universe. Thank's for your help guys, hopefully I'll never have to speak to any of you again.

I mean that in a good way, of course.

This topic is closed to new replies.

Advertisement