General analysis process that causes filenotfoundexception

Source: Internet
Author: User

sometimes, you can double-click a hosted Program , or use assembly. when loading methods to load Assembly , CLR throws system. filenotfoundexception this exception is often misunderstood. For example, there is a hosting program A , references DLL B , although A and B are both in the same folder, however, when you try to run A , an exception similar to the following occurs:

Unhandled exception:System. Io. fileloadexception: Cocould not load file or assembly 'testlib, version = 1.0.0.0, culture = neutral, publickeytoken = eb9fb5aa4f452}' or one of its dependencies. the located assembly's manifest definition does not match the Assembly reference. (exception from hresult: 0x80131040)

 

File Name: 'testlib, version = 1.0.0.0, culture = neutral, publickeytoken = eb9fb5aa4f452bda'

At app. Main ()

 

During my work, I found that many programmers double-click the program in the resource manager, and the program throws an exception in the startup phase, which makes me helpless, because this exception is not like the exception in the program execution process.-There is another opportunity for debugging. This exception cannot be detected through one-step tracking.

 

For example, a hosted program throws an exception when it is started by double-clicking the resource manager. I suggest you re-execute the wrong program in the command line program when troubleshooting. Of course, the results are the same.-It cannot be started, but execution in the command line has a benefit,CLRThe complete exception information will be printed in the command line. Many exception information actually provides a wide range of error cause descriptions, and sometimes provides methods to troubleshoot errors, such:

Set the key value corresponding to the registry according to the highlighted section of the red line above, and run the program again to find out the cause of the error.

 

In addition to the method mentioned above,CLRIn factFuslogvw.exeCan also be used to checkFilenotfoundexceptionThe usage is as follows:

1.OpenFuslogvw.exe, Click"Settings..."Button.

2.In the displayed dialog box, select"Log bind failures to disk"(TellCLRLoadAssemblySome failed error messages are stored in the disk ).

3.To see the error message, check"Enable custom Log Path"Check box, and in the"Custom Log Path"Text box to set the Save path (note that only the complete path of the folder can be filled in)

4.Re-execute the program with an error.FilenotfoundexceptionAfter an exception occurs, switch backFuslogvw.exeAnd click"Refresh"Button.

5. at this time, you should be able to see some new list items in the list box next to it (all failed to load Assembly specific error information), double-click one of them to see the specific cause of loading failure.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.