LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem loading SharpPcap assembly

Solved!
Go to solution

I'm having issues upgrading to SharpPcap V6.1.0 (https://www.nuget.org/packages/SharpPcap/).

 

SharpPcap is a .NET Standard 2.0 assembly.

 

I'm getting "An error occirred trying to load the assembly.". The assembly and all of it's dependencies are located in a directory at the same level as my project file containing the referencing lvclass.

 

I've added a .config file at LabVIEW.exe and .lvproj level with the following content to allow remote sources;

<?xml version ="1.0"?>
<configuration>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>

 

The assembly packages were downloaded though MS VS Community 2020. Using VS I'm able to run an example (Example3.BasicCap ) compiling against .NET Framwork -> net48.

 

What am I doing wrong?

 

Regards,
André (CLA, CLED)
0 Kudos
Message 1 of 4
(1,680 Views)

At the moment it seems to work, but I'm not sure yet why. I created an wrapper assembly in VS and after building it it had also dumped all referenced assemblies and the proper versions thereof alongside my wrapper assembly.

 

I saved a test project and Vi in the same directory and could load the SharpPcap functions without needing my wrapper assembly.

 

So all in al it seems I initially selected the wrong combination of dependencies, it's a mix of .NET Standard libraries and .Net framework versions.

 

I'll update this thread once I have a more definite operating procedure to select the proper set of dependencies and a .NET standard library.

 

I didn't need to create a .config file to make it work.

Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 4
(1,651 Views)
Solution
Accepted by topic author andre.buurman@carya

The final solution involves Visual Studio and an .lvproj.config file.

 

Visual Studio is used to create the list of assemblies with the proper version and target framework.

This proofed to be a mix of .NET standard 2.x, .NET framework 4.x and .NET 5.0 assemblies.

 

For one particular assembly the .config file was required at lvproj level and probably also at executable level to do a binding redirect to a particular version of "System.Runtime.CompilerServices.Unsafe.dll".

Regards,
André (CLA, CLED)
0 Kudos
Message 3 of 4
(1,635 Views)

Hi,

 

This is solved in LabPcap:

 
Feel free to contribute to the project in any way you like.
 
You can also check out the current list of issues:
 
Enjoy your packet capture journey !
 
0 Kudos
Message 4 of 4
(58 Views)