XNA Creators Club Online
Page 1 of 1 (11 items)
Sort Posts: Previous Next

CLR20r3 - System.IO.filenotfound Error

Last post 04-05-2008 12:54 AM by Stephen Styrchak. 10 replies.
  • 04-04-2008 6:44 AM

    CLR20r3 - System.IO.filenotfound Error

    Alright guys

    It appears this error is quite common! I have tried everything from looking at other peoples posts so if it’s ok, I would just like to run what I have tried past you guys to make sure i haven’t missed anything

    Ok so I have my game, created in XNA 2.0 with VS2005 and I now want to run the game on another PC without Game Studio etc installed

    I have compiled a “Release” version in VS2005 and this loads and runs just fine on my development PC.

    On the target PC, I have installed the following:

    .NET 2.0 with SP1

    DirectX 9.0C

    XNA Runtime 2.0

    When I port the files across and attempt to launch I get a “Stopped Working” thing which contains:-a CLR20r3 error with mscorelib, and has an unhandled exception called “System.IO.filenotfound”

     

    I know that this error hasn’t got anything to do with my code, as i get the same error when i try to run a clean application and the “Game State Management” sample on the target machine

    Anything to help would be fantastic as this is driving me nuts!

    Kris

     

     

     

  • 04-04-2008 8:27 AM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Have you read this FAQ?
    Jim Perry

    Here's what I'm up to.

  • 04-04-2008 1:38 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Yeah this was my first port of call and I still had no luck :( thanks for the reply though!
  • 04-04-2008 1:41 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Do you have a try/catch block around all of your code (in the Main method wrap all of that code in a block)? Try doing that and seeing if you catch that exception. If you catch it, just have it ignore it and shutdown. If you can catch the exception, the problem is likely in your code; not the actual framework. If that exception goes uncaught and you see the same message box, then we can determine it's something with either the .NET framework or the XNA framework.

    Out of curiousity, are you by chance using the GamerServicesComponent in your game? I'm unsure of what would happen (error wise) but that component is not available in the XNA GS 2.0 Redist. Just one thing I thought of.

    NickGravelyn -- Microsoft XNA MVP
    Blog | XNA wiki | My Projects
    Write an Article, Win a Zune!
  • 04-04-2008 5:01 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Hey Nick, Thanks for the reply

    I have added a try catch block like so:-

       static class Program
        {
            static void Main()
            {
                try
                {
               
                    using (GameStateManagementGame game = new GameStateManagementGame())
                    {
                        game.Run();
                    }
                }
                catch (Exception e)
                {
               
                }
            }
        }

    and now it compiles and runs fine on my dev PC, but on the target PC the program wont even load (double click, nothing happens)

    my knowledge on exception handling in C# is non existent, what would I need to put in the catch block to detect what exception has been caught?

    and no, I’m not using the GamerServicesComponent in the game

    thanks for your help!

    Kris

  • 04-04-2008 5:05 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Sounds like an exception in your game code. It still might be that the framework is throwing it, but it's not a pre-requisite requirement. The catch block you have is silencing it which is why you don't see anything. Prerequisite errors will bubble up before your code even executes. What I would do now is add a reference to System.Windows.Forms to your project and inside of that catch block put a call to MessageBox.Show giving the stack trace:

    System.Windows.Forms.MessageBox.Show(e.StackTrace);

    Then you will get a full stack trace of where the exception is coming from. This should clearly show which method of yourss (or the framework's) is throwing that exception.

    NickGravelyn -- Microsoft XNA MVP
    Blog | XNA wiki | My Projects
    Write an Article, Win a Zune!
  • 04-04-2008 5:42 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Hello Nick, thanks for the quick reply yet again

    right, i have 2 exceptions that im a bit puzzled over.

    the message box says:

    at GameStateManagmentGame...ctor()
    at at Program.Main() line 95

    the first one, is this a constructor or something?
    the second 1 puts us at "using (GameStateManagementGame game = new GameStateManagementGame())" from the sample posted above

    thanks for your help!

    Kris
  • 04-04-2008 5:46 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Yep so something in the constructor seems to be throwing the exception. You could try using a bunch of try/catch blocks around all the stuff in your constructor to see exactly which part is throwing it. It could be the graphics device creation which might mean something happened with the DirectX installation. But just keep using more and more finer try/catch blocks to find exactly where it's happening.

    NickGravelyn -- Microsoft XNA MVP
    Blog | XNA wiki | My Projects
    Write an Article, Win a Zune!
  • 04-04-2008 6:29 PM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Thanks for your help nick!
    Got those sorted but now i am getting a few more, it never ends!
    These I’m also a bit puzzled over

    at Microsoft.xna.framework.DrawableGameCompoent.Dispose (Boolean Dispose)
    at Microsoft.xna.framework.Game.Dispose

    (and a few more , all having problems with "Dispose")

    Cheers,

    Kris

  • 04-05-2008 12:33 AM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Answer
    Don't forget the Exception type has lots of other properties. So use that MessageBox to display as much as you need to find the other problem. Another user had a similarly named error and it turned out that the end user's graphics card didn't support textures that weren't power of two (http://forums.xna.com/thread/55391.aspx). So make sure you display as much information from that Exception and it will help you figure out where things are going wrong.

    NickGravelyn -- Microsoft XNA MVP
    Blog | XNA wiki | My Projects
    Write an Article, Win a Zune!
  • 04-05-2008 12:54 AM In reply to

    Re: CLR20r3 - System.IO.filenotfound Error

    Instead of printing the stack, simply using ToString will provide the exception type and (usually) a descriptive error message.

    MessageBox.Show(e.ToString());

    The exception type and message are the most important parts in diagnosing these kinds of failures.

    Stephen Styrchak | XNA Game Studio Developer
Page 1 of 1 (11 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG