09-08-2017 05:15 PM
I have come across a similar issue as discussed here:
https://stackoverflow.com/questions/42136239/interop-class-wants-arrays-of-type
When loaded into visual studio generated .NET assembly is wanting a double[*] which apparently means a non-zero based indexed "array" as opposed to a double[] "vector". The solution using Array.CreateInstance() works, but then results in a clunky datatype to work with, compared to just working with double[] vectors.
Does anyone have a good method for working through this issue? The following note doesn't seem to apply to VS 2017 Community, as I tried implementing it, but still produced the type mismatch.
http://digital.ni.com/public.nsf/allkb/C4D7D4F0F33098CC86257F46005D52F2
09-11-2017 03:47 PM
Hi raceybe,
What version of LabVIEW are you using to build your assembly?
Could you give us some insight into how you build the array in LabVIEW?
Thanks,
Mitchell | NI
09-11-2017 03:52 PM
This was Labview 2017 64 bit.
I'll need to build the file again, but It was pretty standard. I built a wrapper around a mathscript node, to implement the linspace() function. There were two doubles and an int32 as inputs (those showed up fine in Visual Studio) and the result was a double array (which showed up as a double[*] instead of double[]).
If you need more than that for recreating it, I can do so, and probably will after I post this.
09-11-2017 04:14 PM
I just noticed that the result is actually expected based on what the Define VI Prototype dialog reports (attached). It reports that the array is of type "Array" which is what requires the work around I outlined in the original post (Array.CreateInstance()). I've also attached the snipped for the image below.
09-12-2017 03:36 PM
Have you tried the 2-dimensional array workaround mentioned in the knowledge base article you linked in your first post?
What was the result?
09-12-2017 03:41 PM - edited 09-12-2017 04:02 PM
I did try it, the result was the same. Still an Array type, rather than double[] or double[][]. Snippet of example attached. Screenshot of out Array also shown inline.
I need to correct myself it appears, though I haven't given it a full workup yet. Using the 2D array output is reported as a double[,] which I think is what is desired. I'll go a bit more in depth to make sure. It could be that when I first tried it, I didn't modify the function prototype after I switched the output to 2D and as a result, I still saw double[*].
I'll try to validate it a little more care and post here again.
11-01-2019 12:21 PM
This issue is (probably) fixed in LabVIEW 2017 SP1, refer to this NI article.