Troubleshooting FileNotFoundException

847 views
Skip to first unread message

d-p-i

unread,
Oct 29, 2016, 4:12:04 PM10/29/16
to Pcap.Net Q&A
Love PCAPDot.Net.  Thank you for this fine work.

I recently developed an application, and it runs fine on a few test machines.  But when I move it to my production environment, it fails with Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'PcapDotNet.Core.dll' or one of its dependencies.

I believe I followed the procedures in the FAQ, here's my checklist:
  • Application built in Release mode
  • WinPcap 4.1.3 installed
  • .NET 4.5 Framework feature enabled
  • Visual C++ 2010 Redistributable Package installed (both x86 and x64 versions)
  • Four PcapDotNet.dll files in same directory with executable  (Base, Core, Core Extensions, Packet)
  • Four PcapDotNet pdb files in same directory with executable
I don't know specifically what is causing the fault, but here are some specifics of my environment that might contribute:
  • C++ redistributables for 2008 and 2013 are also installed (for other applications)
  • Running on Windows Server 2012R2
  • Running on a VM Guest
Any suggestions on how to help troubleshoot this issue?

d-p-i

unread,
Oct 29, 2016, 4:18:29 PM10/29/16
to Pcap.Net Q&A
Oh, more information:
 - Assembly build with .Net Framework 4.5
 - Assembly targeting "Any CPU"
 - Built with Pcap.Net.x86 version 1.0.4.1

d-p-i

unread,
Oct 30, 2016, 1:48:24 PM10/30/16
to Pcap.Net Q&A
More information:

I ran the Assembly Binding Log Viewer against on both the successful and failing system. It doesn't record any binding exceptions on either system, and the logs look pretty similar. Here's the log for binding the Core DLL:

<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (10/30/2016 @ 1:46:13 PM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\Administrator\Desktop\myapp\myapp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = PcapDotNet.Core, Version=1.0.4.25067, Culture=neutral, PublicKeyToken=06a20bc2fabb1931
(Fully-specified)
LOG: Appbase = file:///C:/Users/Administrator/Desktop/myapp/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = myapp.exe
Calling assembly : myapp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Administrator\Desktop\myapp\myapp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: PcapDotNet.Core, Version=1.0.4.25067, Culture=neutral, PublicKeyToken=06a20bc2fabb1931
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/Administrator/Desktop/myapp/PcapDotNet.Core.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\Administrator\Desktop\myapp\PcapDotNet.Core.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: PcapDotNet.Core, Version=1.0.4.25067, Culture=neutral, PublicKeyToken=06a20bc2fabb1931
LOG: Binding succeeds. Returns assembly from C:\Users\Administrator\Desktop\IGMPSpeedTest\PcapDotNet.Core.dll.
LOG: Assembly is loaded in default load context.

</pre></html>

Boaz Brickner

unread,
Nov 5, 2016, 5:46:10 AM11/5/16
to Pcap.Net Q&A
Did you use WinPcap and Pcap.Net that matches you OS (x64 vs x86)?

Justin Ellison

unread,
Nov 23, 2016, 8:41:09 AM11/23/16
to Pcap.Net Q&A
Turns out, PCap.Net (or one of it's dependencies, ha ha), needs version 2013 of the C++ runtime.

Compare this procmon output from a functioning system (http://i.imgur.com/otBjEna.jpg) with the same relevant section on a system that exhibits your symptom (http://i.imgur.com/5IBEMqj.jpg). You'll notice the msvcr120.dll file is missing; this is the 2013 runtime.

Here's the download I used to solve my problem: https://www.microsoft.com/en-us/download/confirmation.aspx?id=40784.

Boaz Brickner

unread,
Nov 26, 2016, 6:44:47 AM11/26/16
to Pcap.Net Q&A
Thanks,

I've updated the User Guide.
Let me know if there's anything else you think that should be changed.

Boaz.
Reply all
Reply to author
Forward
0 new messages