08-26-2015 05:16 PM
I'm creating a solution that calls some LabView code from C# application. I've created a .Net interop assembly for the LabView code that I want to call from my C# application. VI's that have parameters of simple datatypes like int, string, double, etc are callable - no problem. Vi's that use arrays of simple data types like array of doubles, are not callable.
The Labview IDE shows the footprint for function being generated as:
void GetUserTags(out Array Array).
When I view that function in the built dll in the Visual Studio Class browser I see this:
public static void GetUserTags(out array)
Note there is no type on the parameter and hence why I believe its not callable from my C# environment. Anyone got any idea's what happening here? Are array's valid parameters for .Net interop? Am I'm going to have to use an Active X library instead?
Note that this is Labview 2014/Visual Studio 2015 if that matters.
08-27-2015 06:20 PM
Upgrade to LabView 2015. Still the same problem.
Cluster get class definations made, but any fields that are arrays get dropped.
08-28-2015 08:04 AM
Well, apparently I'm not the only one having this issue:
.Net Interop method is not supported by the language
08-28-2015 04:51 PM
Hello Edwwsw
It seems that this is not a LabVIEW issue if you are creating the Interop in the correct way. "When you build a .NET interop assembly, LabVIEW directly translates simple data types such as numerics, booleans, strings, and arrays of simple data types to the corresponding", so you not have a problem to works with arrays in .NET interops
Also you can check more information about .NET interop on the next link
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/building_a_net_assembly/
Regards
Miraquesa
08-28-2015 05:03 PM
Have you gotten this to work specifically with Visual Studio 15? Because just like the other post I tracked down, this problem seems to be showing up in Visual Studio 15.
08-31-2015 08:25 AM
Narrowing it down further.
Arrays of doubles and strings have problems. Arrays of floats seem to pass through. This problem is only showing up in Visual Studio 2015.
09-01-2015 04:58 PM
Hello Edwwsw,
I have on my computer Visual 2010, maybe you wanna try with another version on VS.
let me know the results
Regards,
Miraquesa
09-14-2015 10:44 AM
Looks like MS is working on a solution to the problem.
This issues:
has been updated to like to this bug:
https://github.com/dotnet/roslyn/issues/4924
11-17-2015 03:36 AM
Same problem here.
It seems VS2015 doesnt recognize the arrays beign declared in a Labview .Net Interop DLL.
Here is my function, as you can see there is no defined type
public static bool Init(string filename_Config, out stringArray, out dataArray)
Member of XWaveDv.XWaveDriver
and in the code calling.
Clusters are declared as new typedef and works quite well. But an Array inside a cluster is also not recognized. All the problems are the arrays.
Is there a workaround?? I really need to send a couple of arrays from a labview DLL to C#.
11-18-2015 09:19 AM
This is a known MS bug. They know about the issue (https://connect.microsoft.com/VisualStudio/feedback/details/1668248/net-interop-method-is-not-suppor... and probably have a fix for it (https://github.com/dotnet/roslyn/issues/4924). It just hasn't been release yet.
The problem is that Labview generates IL code for single dimension arrays as if the array were a multidimensional array of rank 1. That is labview treats a[10] as if it were a[1][10] from an .Net low level instructional language (IL) standpoint. This causes visual studio 15 issues.
I've worked around the issue (for now) by just passing two dimensional arrays out of labview. Instead of returning a[10], I return a[2][10]. This is a ugly hack to get around the issue.
NI could also address the issue by generating IL code for a[10] as if it were a single dimensional array.