NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

an error -6579 is reported by CVI When Teststand call CVI dll inclcuded C# dll called

Solved!
Go to solution

CVI calls C# ClassLibarry1.dll (NI example),it can run well,and get number 4 correctly. but if make a cvi dll included a C# ClassLibarry1.dll called  and CVI reports error status = -6579 ( happen at Initialize_ClassLibrary1 () ) when TESTSTAND call this cvi dll .   Please see an attached file. (2012cvi, 2013 teststand ) ,  I don't know why .

0 Kudos
Message 1 of 3
(2,687 Views)
Solution
Accepted by topic author shunfu

Fusion Logs are a good resource to use when debugging issues like this. In the case of your simple example, the logs will show something similar to below.

CVI:

Spoiler
*** Assembly Binder Log Entry  (4/26/2017 @ 6:58:31 AM) ***

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\tester\Desktop\simple net dll_0\simple net dll_0\DLL_CALL.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/tester/Desktop/simple net dll_0/simple net dll_0/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = DLL_CALL.exe
Calling assembly : NationalInstruments.CVI.Reflector, Version=15.0.239.2, Culture=neutral, PublicKeyToken=f83b88e0aaf4fb33.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/tester/Desktop/simple net dll_0/simple net dll_0/ClassLibrary1.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\tester\Desktop\simple net dll_0\simple net dll_0\ClassLibrary1.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
LOG: Binding succeeds. Returns assembly from C:\Users\tester\Desktop\simple net dll_0\simple net dll_0\ClassLibrary1.dll.
LOG: Assembly is loaded in default load context.

 TestStand:

Spoiler
*** Assembly Binder Log Entry  (4/26/2017 @ 6:53:47 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\National Instruments\TestStand 2016\Bin\SeqEdit.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/National Instruments/TestStand 2016/Bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = SeqEdit.exe
Calling assembly : NationalInstruments.CVI.Reflector, Version=15.0.239.2, Culture=neutral, PublicKeyToken=f83b88e0aaf4fb33.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/National Instruments/TestStand 2016/Bin/ClassLibrary1.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/National Instruments/TestStand 2016/Bin/ClassLibrary1/ClassLibrary1.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/National Instruments/TestStand 2016/Bin/ClassLibrary1.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/National Instruments/TestStand 2016/Bin/ClassLibrary1/ClassLibrary1.EXE.
LOG: All probing URLs attempted and failed.

You'll notice that each application is looking for the assembly in its own directory, but ClassLibrary1.dll is not located in the same folder as SeqEdit.exe. You can either put your assembly in that directory, register it in the GAC, or use a config file to specify the location. See this document for more information: 

MSDN: How the Runtime Locates Assemblies

 

Hope this helps!

Trent

 

https://www.linkedin.com/in/trentweaver
Message 2 of 3
(2,663 Views)

Trent,

 

Thank you very much, I have done GAC and solved this problem.

 

 

 

Thanks

 

 

 

 

0 Kudos
Message 3 of 3
(2,629 Views)