Strange error when app starts

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

I have a strange (to me) problem with a c# forms application that I am
developing. The application is installed on approxmatly 30 Windows XP
machines and until recently they all worked perfectly. However since I have
updated the application to a new version one of the machines fails with an
unhandled exception when the application starts. The code in program.cs
works fine and anything before the InitializeComponent(); method in the main
form. As soon as the aplication enters the InitializeComponent method it
crashes with mention of a filenotfound exception.

I have copied the application folder from the failing PC to a good PC and it
works fine which leads me to believe that it must be a system file that is
missing. Likewise if I copy the program folder from a good PC to the failing
one it again fails.

I have reinstalled the app and the .Net 2 framework but to no avail.

Having only done "basic debugging" I'm now a bit stuck.

Any help would be appreciated
 
Are you referencing any assemblies other than those in the System.*
namespaces? If so, you might not have copied other dependent assemblies
to the destination computers. Also, check your app.config files for any
paths that do not exist on those workstations. Finally, if there is an
infrastructure group that maintains these workstations, make sure that
they have not made any changes that you are not aware of.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
 
Other Assemblies
The application does use Crystal and Component One components but they all
installed correctly via the installer

Config Files
The application uses one custom config file and all paths exist

Any suggestions on how to debug an application that runs perfectly on a
development machine but fails in the "real world"

See the following code which is the constructor of the main form:

project.public Form1()
{
MessageBox.Show("This message will show as normal");
InitializeComponent();
MessageBox.Show("This message never shows as the application has now
failed");
}

MJ
 
Hi

Apologies if this suggestion is a little 'basic' but have you wrapped
the call to InitialiseComponents() inside a try...catch so that you can
actually get the full details of the exception in order to establish
what file it is having problems with?
 
Excellent idea which I have tried but it didn't work. The aplication crashed
just the same as though the try catch block had not been entered even though
it enclosed everything.

MJ
 
At the start of the app, add this event handler:

System.AppDomain.CurrentDomain().UnhandledException += new
UnhandledExceptionEventHandler(MyHandler);

This should ultimately trap the exception.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
 
Hi
1. Check the Framework Version which you have developed and the Version of
the Client machine which you have insatlled .
2. Some time we may give the ouput directory to store some file .if you have
any thing like that plz Check that.
3.Check weather all the assembly are properly Placed.
4.Check weather all the Third Party Control are installed properly (if any)
5. Check weather any of you controls uses any Skins which should be place in
proper place..

Regards
Prabakar
 
Back
Top