简体   繁体   中英

Application crashes immediately with FileNotFoundException

This is driving me demented so hope someone can help!

I have developed a small application in C# that uses the CefSharp (Chromium) component. This application runs fine on any PC where VS2015 is installed however it crashes immediately without warning or exception dialog on a non-development machine.

The solution is built for x86 and the issue occurs with a Release or a Debug version of the application.

I have used the Assembly Binding Log Viewer (Fuslogvw.exe) program however it does not report any errors with my bindings - all reports say OK.

Windows error log:

Application: Launcher.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at Launcher.Program.Main()

Can anyone advise on what I can do to try and identify this issue?

Edit: Directory listing of install location on non-development PC.

16/12/2015  00:28           440,320 Launcher.exe
12/12/2015  10:59             1,688 Launcher.exe.config
16/12/2015  00:28            77,312 Launcher.pdb
16/12/2015  00:28            22,696 Launcher.vshost.exe
12/12/2015  10:59             1,688 Launcher.vshost.exe.config
30/10/2015  07:19               490 Launcher.vshost.exe.manifest
12/12/2015  10:55         2,197,289 cef.pak
12/12/2015  10:55           647,680 CefSharp.BrowserSubprocess.Core.dll
12/12/2015  10:55            11,264 CefSharp.BrowserSubprocess.exe
12/12/2015  10:55           974,336 CefSharp.Core.dll
12/12/2015  10:55            28,004 CefSharp.Core.xml
12/12/2015  10:55           139,776 CefSharp.dll
12/12/2015  10:55            23,040 CefSharp.WinForms.dll
12/12/2015  10:55             4,223 CefSharp.WinForms.xml
12/12/2015  10:55           230,962 CefSharp.xml
12/12/2015  10:55           296,406 cef_100_percent.pak
12/12/2015  10:55           403,210 cef_200_percent.pak
12/12/2015  10:55         3,873,562 cef_extensions.pak
11/12/2015  22:50             5,040 cloud.png
12/12/2015  10:55         2,106,216 d3dcompiler_43.dll
12/12/2015  10:55         3,466,856 d3dcompiler_47.dll
13/12/2015  00:34             5,976 debug.log
12/12/2015  10:55         4,405,316 devtools_resources.pak
12/12/2015  10:55        10,206,624 icudtl.dat
11/12/2015  22:50             2,051 launch.html
12/12/2015  10:55        50,612,224 libcef.dll
12/12/2015  10:55            75,264 libEGL.dll
12/12/2015  10:55         1,874,944 libGLESv2.dll
16/12/2015  22:13                 0 list.txt
16/12/2015  00:30    <DIR>          locales
12/12/2015  10:55           410,979 natives_blob.bin
11/12/2015  22:50           129,382 output.ico
11/12/2015  22:50            26,554 portal.png
16/12/2015  08:18           543,928 procdump.exe
15/12/2015  23:03             2,732 relnotes.txt
12/12/2015  10:55           463,528 snapshot_blob.bin
16/12/2015  00:30            22,952 unins000.dat
16/12/2015  00:30         1,197,891 unins000.exe
12/12/2015  10:55           202,240 widevinecdmadapter.dll

Use Process Monitor from Windows Sysinternals (part of Microsoft TechNet) in order to monitor the file activity of your application.

You will notice that an immense amount of events are logged. Most of them regarding accesses to the registry. But fortunately you can install different kinds of filters. If you know the name of the process you want to analyze, filter by process name.

You will see which files the app tries to access and whether the access was successful or not.

The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException

If you get this error, ensure you have Visual C++ 2012/2013 Redistributable installed.

http://www.codeproject.com/Articles/1058700/Embedding-Chrome-in-your-Csharp-App-using-CefSharp

Are you referencing a file that the non-development machine can't find? Is the file access happening in your own code or in the CefSharp component?

Try putting in a file.exists check before the code for the target file and log that result

Sorry if this is something you've already tried though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM