Thursday, 6 August 2009

System.IO.FileloadException error

At work we had an issue when trying to deploy a .Net 3.5 application to servers.

It would work correctly on all our development machines but when we deployed it to the server the process would show up in Task Manager but then disappear.

We found an entry in the Event Viewer as shown below

----------------------------------------------------------------------------------

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 06/08/2009
Time: 11:29:34
User: N/A
Computer: XXX
Description:
EventType clr20r3, P1 xxx.exe, P2 1.0.0.0, P3 4a7aaf1b, P4 xxx, P5 1.0.0.0, P6 4a7aaf1b, P7 9a, P8 f, P9 system.io.filenotfoundexception, P10 NIL.

-------------------------------------------------------------------------------------

We found that a system.io.filenotfoundexception means that the application cannot find a dll / assembly of some sort, but we didn't know the name of the dll or assembly. After a bit of digging (http://stackoverflow.com/questions/295161/) we found that we could catch exceptions when the main form is loaded in (Program.cs) as below:

try
{
Application.Run(new MainForm());
}
catch (Exception ex)
{

MessageBox.Show(ex.Message);

}


When we ran the application on the server we got an error
The error showed that the ReportingServices dlls were the wrong version. We had copied 2005 (version 8.0.0.0) dlls into the application folder, but our application required 2008 (version 9.0.0.0) dlls.

Hope this helps some one

3 comments:

Anonymous said...

Singh is King... It helped us too :)

Sony said...

Glad to hear it helped

Peter Thompson said...

Hi, thanks for sharing. I helped it. Your hopes have come true. My friend advised to download the dll files http://fix4dll.com/kernel32_dll, but I could not find the desired file. So to say not identify the file. Maybe someone come in handy. Good luck.