Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated

Why Can’t I Call my LabVIEW-Built Interop Assembly with an Array Parameter in Visual Studio 2015?



Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 2009 SP1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Toolkits>>LabVIEW Application Builder

Problem:
I created a .NET Interop Assembly in LabVIEW. This assembly contains a function which takes a one-dimensional array of doubles as a parameter. I am able to call this function from Visual Studio 2013 and earlier as expected. However, starting in Visual Studio 2015, this function is not found by IntelliSense.

When I attempt to make the call manually, the code does not compile and an error is thrown that the type is not supported by the language.  In Visual Studio 2017, the error thrown is that the Value of type 'Double()' cannot be converted to 'Double(*)'.  How can I use array parameters in my .NET Interop Assembly with Visual Studio 2015 and later?


Solution:
When a .NET Interop Assembly is created in LabVIEW, a one-dimensional array is represented as a multi-dimensional array of rank 1. In Visual Studio 2013 and earlier, this data type was recognized as a one-dimensional array. However, with the introduction of Visual Studio 2015, this type is no longer supported. 

In order to use a one-dimensional array parameter with Visual Studio 2015 and later versions, the workaround is to replace the one-dimensional array with a two-dimensional array in LabVIEW and re-build the .NET Interop Assembly. Visual Studio 2015 recognizes the two-dimensional array and the .NET programmer can then choose to ignore the second dimension if only one dimension is necessary. 


Related Links:
LabVIEW Help: Building a .NET Interop Assembly (Windows) 
LabVIEW Help: Characteristics of LabVIEW-Built .NET Interop Assemblies 

Attachments:





Report Date: 01/26/2016
Last Updated: 10/06/2017
Document ID: 75PA3RY0

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit