System.IO.FileNotFoundException. Where do I find what path is wrong?

Stelios picture Stelios · Feb 7, 2014 · Viewed 8k times · Source

I create small Windows Forms progs in VisualStudio2010, just for hobby. After releasing them I use the .exe file to run them on other PCs, without having to do any installation. Those PCs run Windows OS(7,vista,XP). The PC which I wrote the code had Win XP and the progs managed to work fine anytime.

Now I wrote another prog, on another PC, which runs Win 8.1 and I get the following error whenever I try to run the released .exe at other platforms, as mentioned above.

Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: dmg_ors.exe
  Problem Signature 02: 1.0.0.0
  Problem Signature 03: 52f4bad1
  Problem Signature 04: DMG_ORS
  Problem Signature 05: 1.0.0.0
  Problem Signature 06: 52f4bad1
  Problem Signature 07: 3
  Problem Signature 08: c
  Problem Signature 09: System.IO.FileNotFoundException
  OS Version:   6.1.7601.2.1.0.256.48
  Locale ID:    1033
  Additional Information 1: 82e2
  Additional Information 2: 82e23b36efee975bd0e9417ff09fe7bb
  Additional Information 3: a1d6
  Additional Information 4: a1d6e932d2c942475edff9f8fe05b46c

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.tx

How can I locate what file is missing? tyvm

Answer

Stelios picture Stelios · Feb 9, 2014
Problem solved.I had to modify my main,IOT to catch that exception and see what
was actually missing.

 static void Main()

{

 Application.EnableVisualStyles();
 Application.SetCompatibleTextRenderingDefault(false);
 Application.ThreadException += new  

ThreadExceptionEventHandler(Application_ThreadException);
      AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

  Application.Run(new Form1());

}

static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
  MessageBox.Show(e.Exception.Message, "Unhandled Thread Exception");
  // here you can log the exception ...
}

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
  MessageBox.Show((e.ExceptionObject as Exception).Message, "Unhandled UI Exception");


     // here you can log the exception 

}

Then I could see that the problem existed because Visual Basic Powerpack needed to be installed.I assume that machines without VS2010 installed,even if they have .NET 4.5, do not have that. The question is though, what was the difference this time and that package was needed IOT run the application.... The solution was found here actually, I need to say that. http://www.csharp-examples.net/catching-unhandled-exceptions/