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

你说的曾经没有我的故事 提交于 2020-01-13 08:44:08

问题


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


回答1:


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/



来源:https://stackoverflow.com/questions/21627042/system-io-filenotfoundexception-where-do-i-find-what-path-is-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!