Some courses and learning paths on NI Learning Center may not appear on learner dashboards. Our team is actively investigating.

If you encounter access issues, please contact services@ni.com and include the learner’s name, email, service ID or EA number, and the list of required courses.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a .NET ReadOnlySpan

Solved!
Go to solution

@T. wrote:

 

Hello,

This is how I would have imagined it. Unfortunately, an error always comes out of the CreateInstance method.

 

 

T_0-1666011222050.png

Thanks...

 


The error tells you you're trying to create an instance of the interface and your type string does indeed have IList as the type. You should change it back to List.


___________________
Try to take over the world!
0 Kudos
Message 11 of 35
(1,971 Views)

Hello,

Now it works. I thank all who have supported me here super.

I will not be afraid to post my next problems here 😁

 

0 Kudos
Message 12 of 35
(1,956 Views)

@T. wrote:

Hello,

Now it works. I thank all who have supported me here super.

I will not be afraid to post my next problems here 😁


It could help others to post your solution...

0 Kudos
Message 13 of 35
(1,948 Views)

Hello,

As shown in this example, I manage to fill the list accordingly.

Have a nice day and thank you....

 

 

T_0-1666100625280.png

 

Message 14 of 35
(1,931 Views)

@T. wrote:

As shown in this example, I manage to fill the list accordingly.

Have a nice day and thank you....


Your first kudo for that...

 

Note you need to close the type reference used for the activator.

 

Note you need to close the NodeId reference.

 

Note you're recycling a reference to the list. It will grow 1 item for each call, forever. The list is not by wire...

 

These are references to the objects. If you don't need to refer to them anymore, close the reference. This won't (always) close the object. If the object is inserted in another object, the object will live on there.

0 Kudos
Message 15 of 35
(1,917 Views)

Hi,

It works fine in LV dev, but fail when compiled into a PPL.

Any idea ?

My guess is that System.Memory is not loaded by the PPL, which leads to a null reference outputed by the last GetType method (on the right side of the diagram).

Untitled.png

 

1.jpg

0 Kudos
Message 16 of 35
(1,756 Views)

Yes, it looks like the assembly isn't loaded in the PPL.

 

You can probably force it by putting anything static from the assembly on the diagram (or front panel probably) of the VI. Do make sure it isn't compiled out by the dead code removal algorithms.

 

DLLs have an option to share some resources with the host environment, but I'm not sure if PPLs have that.

0 Kudos
Message 17 of 35
(1,752 Views)

Also, don't forget to close the 1st array createinstance reference. (after passing it to the 2nd createinstance args)

0 Kudos
Message 18 of 35
(1,746 Views)

Here's how I create an array:

Array To dotNET.PNG

 Esp. note the false case:

wiebeCARYA_0-1677664660386.png

 

0 Kudos
Message 19 of 35
(1,744 Views)

Yes you're right,

I deleted the right side of the diagram before posting it for confidentiality reason, but it's well closed in the original one.

0 Kudos
Message 20 of 35
(1,724 Views)