NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize .NET assembly using TestStand C/C++ adaptor

Hello All, 

I’m trying to run CDotNetLoadAssembly, from TestStand , but it returns -6579 error code. The assembly file itself is in the same folder as sequence file and the whole project is.

After a debugging procedure, I found out that the actual path that TestStand was referring to, was different than the path of the sequence file and the assembly file.

I tried to register assembly path using CDotNetRegisterAssemblyPath but it didn’t solve the issue.

Then I moved my assembly file to the path that I found in debug process, rerun the sequence again, no error appeared. Also, I was able to invoke other functions from the assembly file.

How can I configure TestStand to refer to specific folder/library to complete the "CDotNetLoadAssembly" action successfully?

 

Best Regards,

Art

0 Kudos
Message 1 of 7
(2,629 Views)

Is there any reason you're using the C/C++ adapter instead of the .NET adapter?

 

What you're describing is expected behavior for .NET -The assembly you're trying to load needs to be in one of these places:

  • The GAC
  • The application directory (The location of SeqEdit.exe or the user interface .exe)
  • A probing path specified in a config file. (if the probing path isn't in a subdirectory of the application directory, the assembly must be strong-named for this to work).

See this document for more information: 

MSDN: How the Runtime Locates Assemblies

 

-Trent

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 2 of 7
(2,576 Views)

Hi Art,

 

When you use CDotNetRegisterAssemblyPath, what's the value of the status int that's returned? Also, what is the path that TestStand is expecting the assembly when you were debugging?

 

Justin

0 Kudos
Message 3 of 7
(2,573 Views)

Hi Trent, 

I'm using C/C++ adapter because I invoke a dll from CVI, that wraps .NET assembly. Once I move the assembly file to a path that TestStand "looking" at - ...\Public\Documents\... don't quite remember (currently not at the working station). Everything works fine. But I would like to remain in my project path.

 

Thanks for the support,

Art

0 Kudos
Message 4 of 7
(2,569 Views)

Hi Justin,

CDotNetRegisterAssemblyPath was successful. I will double check it. Regarding the path that TestStand was looking at, it was somewhere in user\Documents\Public\..... 

 

 

0 Kudos
Message 5 of 7
(2,567 Views)

CDotNetRegisterAssemblyPath will not help for this. If you do not want to move it from it's current location, you can specify it's location with the <codeBase> element in a config file. For this to work, the assembly must have a strong name if it's not in a subdirectory of the application.

 

I would strongly recommend reading through the MSDN link in my last post.

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 6 of 7
(2,562 Views)

Thanks, I will definitely do so.

0 Kudos
Message 7 of 7
(2,534 Views)