System.IO.FileLoadException when running C# program on a different computer

拈花ヽ惹草 提交于 2019-12-05 20:51:14
How can I figure out what this problem is and fix it.

Perform a remote debug using the visual studio remote debugger.

This tutorial gives an idea of how to use it.

Once you get familiar with the VS Remote Debug, you will always use this powerful tool to test on a potential client environment.

As for your particular problem, you have some code in the Application.Startup event handler that tries to load some file and fails. Post a code in your App.xaml so we can analyze, if you won't be able to find the problem source yourself.

Fuslogw could help investigate errors with library binding see Fuslogvw.exe (Assembly Binding Log Viewer)

How you create Sqllite connection? May be this post help DbProviderFactory

According to the stack trace the problem is occuring in Application_Startup which was called by OnStartup. Therefore you should check if you've implemented/overridden or wired up to those events in code that might be gerenating those exceptions. Since it is possible for multiple methods to subscribe to the event handler, there's no guarantee the problem is in your code.

You could create some logging checkpoints to help narrow down the location of the error, as well as log values in the context of the error.

You could also use remote debugging to try and narrow down the location of the error.

There are also a couple of Unhandled Exception even handlers that you can google and learn how to implement so that you can perform logging whenever the error occurs, but generally at that point it's far to late to get anymore information other than closing gracefully, so that's probably a alst ditch approach.

You can also use the SysInternals tools like this to determine what files the program is attempting to access, and filter down to failures: http://technet.microsoft.com/en-us/sysinternals/bb896645

You could determine what the last file it was attempting to access was, and even possibly see what the error is at the OS level. I've found this tool to be valuable in dealing with strange file access problems. It takes a while to figure out though.

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