views:

94

answers:

2

I made a program with Visual Studio 2010. It required .NET Framework 4.0 to run, and the machine it needs to run on is not connected to the internet, so I found the redistributable online on my own machine and copied it over.

I installed the software on the machine (it's a very simple program, I just made up an installer to do the .NET installation as well as putting the .exe file of my program into Program Files) but any time I try to run it, I get a Windows Error Report message saying the program failed to run.

Are there any suggestions as to where I could look for the cause of this issue?

(If it matters, the machine I'm trying to run it on is running Windows XP while I am running Windows 7. I don't think this is a compatibility issue though...)

+5  A: 

The problem you're having is with error handling. There is probably an environmental issue such as a missing folder, registry setting, or some other configuration. That would explain why it works on your dev machine and not the other (a common occurrence.) Your app is throwing an unhandled exception and crashing.

There may be information on the error in the Application log, including a stacktrace you can use to diagnose the issue. Once you have determined the problem, you will also want to ensure that you have sufficient exception handling so you can raise friendly error messages and prevent your app from crashing.

Dave Swersky
how can I fix this though? I don't know what exception(s) are going unhandled...
rar
Agreed. It won't be in the event log, write an event handler for the AppDomain.CurrentDomain.UnhandledException event. Display e.ExceptionObject.ToString().
Hans Passant
How do I write that though? I'm a bit new to C#.
rar
@rar type 'System.AppDomain.CurrentDomain.UnhandledException +=' in VS and let the editor create a new handler for you. Then just `MessageBox.Show(e.ExceptionObject)` [See here](http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx) for more info.
Will
'MessageBox.Show(e.ExceptionObject)'Argument 1: cannot convert from 'object' to 'string'
rar
'MessageBox.Show(ToString(e.ExceptionObject));' no overload method for 'ToString' takes 1 arguments
rar
+1  A: 

Could possibly be that you built a 64 bit app and you're trying to run it on a 32 bit machine.

msergeant