Jump to content

Recommended Posts

After a 20 year hiatus, I'm back to writing text code again. Not just any text code, but C# .NET assemblies. After about a day and a half of googling and self teaching, I've hit the wall.


I've got a .NET assembly that was provided by a manufacturer that controls some hardware. We are calling the higher level .NET functions from Labview and they work. But we aren't getting acceptable performance for the high level calls, so we are trying to drill down into the lower level calls.


One of the .NET methods requires an ICollection<T> input, there in this case T is a channel object that is created elsewhere. The ICollection function is described the in the MSDN article: http://msdn.microsoft.com/en-us/library/92t2ye13


For reasons I don't really understand, Labview doesn't apparently support a constructor to ICollection. Something about Labivew not supporting calls to .NET generics, but I'd be lying if I said I understood that. But it seems like it should be possible to create a .NET assembly that creates a reference to an ICollection .NET object that can be passed to Labview. But I can't get it to work.


I've written a simple program that contains two methods. The first method GetUInt32 simply returns an input integer and was written as a test to see if I could write and assembly and call it from Labview. It works great.


The second method, GetICollection, is a test case to create a collection of UInt32 integers. Should be really simple, but it generates a compiler error. I suspect I'm doing something really basic incorrectly, but I'm at a loss to understand what. Can someone point me in the correct direction?






Link to post
Share on other sites

The problem is that you can't instantiate an abstract or interface class. The ICollection interface requires you to create a class that implements the ICollection interface. See




For more explanation.


I don't have Visual Studio handy or I'd write a brief example. Let me know if you need the example and I'll get to it.





Link to post
Share on other sites

LabVIEW simply does not support working with any generic data type. See "Which .NET Features Are Not Supported In LabVIEW?" here:



You will need to create a wrapper (in C# code) around some ICollection class of a concrete instantiation, compile that as an assembly, and then instantiate that in LabVIEW.

Link to post
Share on other sites

Ah, I get it now.  Yep, creating an instance of a concrete class did it.  My wrapper code appears to be working.  Thanks!


I'm up to 2 whole days of programming .NET.  Time to add .NET programmer to my resume.

Link to post
Share on other sites
  • 7 years later...

Hi Eric,

I was wondering if the hardware you refer to is the OM-DAQ-USB-2401 (thermo couple readings, manufacturer: Omega) (?).
While implementing this piece of hardware in Labview, I encounter this exact problem:

"One of the .NET methods requires an ICollection<T> input, there in this case T is a channel object that is created elsewhere."

I am able to perform a single channel read. However, if I want to scan multiple channels I need this Icollection method, but I do not know how to refer/initiate this.

Does anyone have a solution for this?



Link to post
Share on other sites
On 5/6/2013 at 4:59 PM, hooovahh said:

I've seen people add LabVIEW to their resume with less experience then that.

Well to be fair, some companies have done the same thing to their employees who have never claimed any experience with a particular item/software/etc..  I've worked a couple of places where it has been: "Oh, you double-clicked the icon for "X" application?  You're now the resident EXPERT!". 

Not too long ago, we had a "Kaizen" event where we had moved a piece of equipment in a production cell.  I knew nothing about said piece of equipment but it was Windows-Based, so I figured I would go ahead and reconnect the keyboard, mouse, monitor and power it up just to make sure that it still booted after the move.  A couple of people had seen me do this and now every time there's an issue with it, I'm called to look into it. 

(Sorry to go OT)

Edited by Bryan
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By bartek618
      I know how to run .Net executable by MainWindow() constructor but I have some resources defined in App.xaml and MainWindow() doesn't run without them. How to run application starting with App() constructor? Also I need to pass some parameters into MainWindow().
    • By William Hofmeister
      I need to access Aerotech A3200 data with LabView. The Digital Scope in the A3200 software has the capability to record data at 1kHz for 8 seconds in dedicated batches. We use LabView for all functions surrounding the motion control and have the Aerotech LabView package. Using the LabView vis we can only access data a single data point per call and I don't see how to set up a FIFO to Windows LabView. Someone must have looked at this problem lately. Can anyone steer me in the right direction?  Thanks!!
    • By LogMAN
      So this just happened to me and I'm quite confused by it. As it turns out, the .NET Constructor Node not only provides terminals for error in, error out and the reference, but actually two more "hidden" terminals:

      Notice: I left the error terminals untouched and none of the wires are connected (try it yourself). This never occurred to me. Only now, while hunting a null reference exception I found the constructor node looked "off", like this:

      The strange part is that the terminal doesn't actually carry the reference (which is why I receive the null exception). It only specifies the type. The upper left terminal is a void type input, so the wire is always broken.
      Does anyone know why these extra terminals exist? They don't seem to be part of the specification as far as I can tell.
      Any fancy things we can do with this?
    • By ATE-ENGE
      Edit: I'm asking primarily if there is a reason why/when I should/shouldn't use .net functions in my LabVIEW development. The example below is just to demonstrate a case of my question.
      I recently found a custom library that calculates SHA256 hash algorithms However, in this post I see that the same thing can be done with .net 
      My main question is: Is there any reason to build or use a custom library for something where .net functionality already exists? Are there any disadvantages to offloading work to .net ? 
    • By Gribo
      Hello, I am trying to copy multiple cells in LibreOffice, using the UNO API. I encountered an issue in the XCellRangeData object.
      The object's method returns an array of array of any() type. it seems LV can't compile this, even though the wire appears not to be broken. If I try to parse the array of array into a single dimension and then rebuild, the code is broken. See the attached files. Is there a solution for this issue? The alternative would be to copy cells one by one, which is a much slower solution.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.