Troubleshoot system.io.fileloadexception

I have a .net 3.5 WinForms application that works fine on my machine, but on another machine it immediately crashes with system.io.fileloadexception. Unfortunately, there are no details about which file could not be downloaded, so I do not know where the problem really is.

I believe that I know which one may be (SQL Server Compact edition), but before I hunt aimlessly, I wonder if there is a way to find out what caused the file access, other than using FileMon from SysInternals.

The only error message:

EventType clr20r3, P1 myapplication.exe, P2 2.1.0.0, P3 490eca78, P4 myapplication, P5 2.1.0.0, P6 490eca78, P7 2e, P8 21, P9 system.io.fileoadexception, P10 NIL.

+6
source share
4 answers

Enable fusion logging ?

This blog post by Brad Wilson gives information on what to do if it fails ...

+13
source share

You can try to make your Main() method more robust to catch (and throw) an exception ... so> .

Often the problem is that too much code gets into the outermost Main() method. JIT should be able to fully understand Main() , otherwise none of your code might work. By making Main() simpler, you have a chance. In a related example, if MainCore() fails: excellent, we can still catch the exception in Main() .

This works because JIT is executed by method by method ... i.e. MainCore() not JIT until it is called, and by this time we already have our try / catch.

+6
source share

Hook and magazine AppDomain.AssemblyResolve

+2
source share

Take the Microsoft Debugging Tools SDK and use either windbg or cordbg to attach and run the application. This should give you at least the key to solving the problem, if you don't identify the problem.

+1
source share

All Articles