NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TS 24 and .Net 8.0, big disapointement

Solved!
Go to solution

Hello team,

 

I was eagerly waiting for TS 24 to be albe to use my traceability DLL made in .Net 8.0.

 

Since in the service we have installed TS24, lot (most of) old assembly in all version of .Net have issues.

Another colleague already ask about Framework and GAC.
Now i want to know better about .Net8.

Is TS24 native Net Std 2.0, Net8.0 or still the old and unwanted Framework 4.x ?

My DLL works with some king of plugins, which are also C#/ .Net 8.0 assembly.

We load the plugin with the method "Activator.CreateInstance()".
Code below 

jungledede_0-1729524559352.png

With a ".exe" debug in .Net 8.0, no issue, loading and creation of the constructor of my class of my assembly is going as expected.

 

With TS23 and all my dll in .Net std 2.0, loading and creation of the constructor of my class of my assembly is going as expected.
With TS24 and the DLL in .Net8.0 generate System.InvalidOperationException

I am a bit lost here. i canot use my .Net Std 2.0 build as it got deprecated dependencies from Microsoft, so no way i put it in production for the next 15 years.
I need the full Net 8.0 to works.

So i wonder if it not a GAC related issue.
Do you know how i can check?



We were happy of NI finally being up to date. We are kinda disappointed how it have turned. 
We use the GRPC api of teststand and since no update of the git repos are made, we fear we will find compatibility issue when we'll start checking this part..

0 Kudos
Message 1 of 8
(645 Views)

I haven't gone down this rabbit hole yet, but I'll soon have to...

 

Guess you've seen

 

Oli_Wachno_0-1729574201570.png

 

 

From what I understand, the TestStand development has decided to follow a different .net support strategy than the LabVIEW Team for IMHO the sake of implementation speed.

 

Though I have to admit, that I find it quite confusing and difficult to find intuitive information for non-.net pros.

0 Kudos
Message 2 of 8
(611 Views)

Hi jungledede,

 

TestStand is still in the process of migrating completely to .NET Core. The .NET adapter (which is responsible for loading and executing your code module) is already fully in .NET 8.

The Sequence Editor, built-in step types and tools etc which are also .NET based are not migrated yet and this is being worked on for the next TestStand release. Once done, all these applications will be in .NET 8 as well. Currently they are still in .NET framework 4.8.

 

You should be able to target your code modules to .NET 8 and use them with TestStand 2024 Q4, that is the expected workflow.

 

From the fact that you are able to execute your dll through a .NET 8 executable without issues and that the exception is not a FileNotFound but rather InvalidOperation, i would suspect that the issue might not be related to having dependencies in the GAC.

 

Would you be able to provide a simplified version of your code which shows the error so we can check what's going on. Just based on looking at your code snapshot, i am unsure why an InvalidOperation exception is being thrown.

 

Regards,

Tinu

 

 

0 Kudos
Message 3 of 8
(593 Views)

Hello,

After few holidays and days of trying to figure it out, well, I still dont find any solution. I try a lot of ideas, none are working. 

I'll call official support, but honestly i am a bit lost and out of idea to make it work. For sure i cannot change the architecture of my code for this feature.

 

Again, everything is working fine when the exe app that load my DLL is my debug app in .Net8

When loading from teststand 24 i got the issue.

So, let's see what i have try:

 

With better error management and breakpoint, i am able to see that the issues is that we get a type mismatch, and we cannot cast the "type" to the interface.


plugin = (IpluginFoo)Activator.CreateInstance(type);

 

 

I force to compile in x64 for CPU and target win-x64 instead of default values (msil?), no effects

 

With debugguer i compare the type between my manager and my plugin, we got the same Interface (export to file, then win merg tell me no difference)

 

I found the way to see all dll loaded in memory, i see some differences, like a very important one. When using testsand 24, the C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\netstandard.dll is not loaded 🤣 

I was quite happy to see that, well, when i force all the missing assembly, no difference 😖

difference of assembly between native net8 app ond teststand 24difference of assembly between native net8 app ond teststand 24

Load them that way:

jungledede_1-1731050708322.png

 

I haven't yet look inside the NI dll, maybe they redo some in-house dev of very basic code like the Malloc on CVI...

 

I try to use the option of Activator.CreateInstance, still no effect, still the some invalidcast...

jungledede_3-1731050905325.png

As you can see, the interface name is not just IPlugin as we though with colleagues that this name may be used. So, i rename it to add more words and my company name in it, for sure it is not reuse somewhere else.

 

I finish by making a very strip down and basique c# project, and same issue.

jungledede_4-1731051081833.pngjungledede_5-1731051095672.pngjungledede_6-1731051103696.png

 

I join the archive of the simple project + the seq fil that call it


It is a basic feature of c#, i should not be the only one with this issue.

0 Kudos
Message 4 of 8
(505 Views)

By any chanve will it work with self contained set to true?

 

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>

</PropertyGroup>



Alternatively before calling this module You can use to check what exactly he is missing:

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

 

In net 4.8 we had issues when teststand tried to find some libraries in GAC insted of dll directory and we solved it by redirecting with this event

0 Kudos
Message 5 of 8
(471 Views)