<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>FAQs</title><link>http://forums.xna.com/forums/35.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>How To Solve "&lt;MyGame&gt; has had an error and needed to close. Send an error report."</title><link>http://forums.xna.com/forums/thread/55966.aspx</link><pubDate>Mon, 07 Apr 2008 18:40:31 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:55966</guid><dc:creator>Nick Gravelyn</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/55966.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=35&amp;PostID=55966</wfw:commentRss><description>A frequent problem found after distributing an XNA Game Studio game to another computer is double clicking the EXE only to get a window with this sort of message in it:&lt;br&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;"&amp;lt;MyGame&amp;gt; has had an error and needed to close. Send an error report."&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br&gt;This message really could mean a couple of things:&lt;br&gt;&lt;ol&gt;&lt;li&gt;You didn't actually run the redists described in the dependency FAQ: &lt;a href="http://forums.xna.com/thread/9924.aspx"&gt;http://forums.xna.com/thread/9924.aspx&lt;/a&gt;. First thing you should do is run all of those redists. Don't &lt;i&gt;assume&lt;/i&gt; they are installed; run the redists and they will install if needed.&lt;/li&gt;&lt;li&gt;There is an uncaught exception in your code.&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;br&gt;To find out if there is an uncaught exception, follow these steps:&lt;br&gt;&lt;ol&gt;&lt;li&gt;First, add a reference to System.Windows.Forms in your game project. &lt;/li&gt;&lt;li&gt;Next, in your Main method (found in Program.cs by default), wrap the entire code in a try/catch block that looks like this:&lt;/li&gt;&lt;/ol&gt;&lt;div style="background-color:White;"&gt;&lt;div style="margin:0px;padding:2px 2px 2px 8px;background-color:White;overflow-x:scroll;overflow-y:hidden;width:505px;"&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;static&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;void&lt;/span&gt; Main()&lt;br&gt;{&lt;br&gt;    &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;try&lt;/span&gt;&lt;br&gt;    {&lt;br&gt;        &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;using&lt;/span&gt; (Game1 game &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;new&lt;/span&gt; Game1())&lt;br&gt;           game.Run();&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;catch&lt;/span&gt; (Exception e)&lt;br&gt;    {&lt;br&gt;        System.Windows.Forms.MessageBox.Show(e.ToString());&lt;br&gt;    }&lt;br&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;Run your game again. You should see a window pop up with the exception details printed. Now you can use this information to fix the uncaught exceptions in your game. For more information on exceptions and try/catch blocks, see these sites:&lt;br&gt;&lt;br&gt;&lt;a href="http://www.csharp-station.com/Tutorials/Lesson15.aspx"&gt;http://www.csharp-station.com/Tutorials/Lesson15.aspx&lt;/a&gt;&lt;br&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/0yd65esw.aspx"&gt;http://msdn2.microsoft.com/en-us/library/0yd65esw.aspx&lt;/a&gt;&lt;br&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/dszsf989%28VS.71%29.aspx"&gt;http://msdn2.microsoft.com/en-us/library/dszsf989(VS.71).aspx&lt;/a&gt;&lt;br&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.exception.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.exception.aspx&lt;/a&gt;&lt;br&gt;&lt;br&gt;If, however, you run that code and don't see a window pop up with that information, that indicates you did not actually perform step 1 of installing the dependencies. Please use the link above to install the dependencies and run the game again.&lt;br&gt;</description></item></channel></rss>