Showing results for 
Search instead for 
Did you mean: 

How do I call a method from a .NET assembly created with LabVIEW 2009 where method parameter list includes enum?

I built a .NET assembly from a LabVIEW 2009 project and I want to call some methods in this assembly from a C# .NET application I am writing.  The LabVIEW vi contains two enum controls defined as First_Enum, values = VAL_1, VAL_2, VAL_3, VAL_4, VAL_5; and  Second_Enum, values = VAL_2-1, VAL_2-2, VAL_2-3.


When I set up the build for the .NET assembly it defines a prototype like the following:


                                          void assemblyName(ED1 paramName1, ED2 paramName2)


where I presume ED1 and ED2 represent the enums defined on the FP.


In the C# application I add the newly created assembly and add a reference to it in my project explorer.  When I attempt to call the method assemblyName(), I am not able to select any of the defined values of the enums.  I have attempted to define a variable of type ED1, e.g, but when I do this there are no options for values.


Can someone help me with this?  I have tried everything I can think of, both regarding different options when building the .NET assembly in LabVIEW and referencing these values in my C# code.


0 Kudos
Message 1 of 5

Hi protocol_alpha,


I created a .NET assembly that included enums.  However, when I build the assembly, it defines my enums as UINT 16.   This makes sense because an enum passes an integer.  I'm not sure why you are getting a definition of ED1 or ED2.  Could you post your code so that I can try to replicate what you're seeing?


Best Regards


Starla T. 

0 Kudos
Message 2 of 5

We see probably the same error with LV2010 here.


It appears to be a bug in LabView that if the class contains

a. an enum declared as an ulong

b. at least 1 method that either takes in the enum as a parameter and/or return the enum.

c. If you have this in the enum in hex format, like "ALL = 0xFFFFFFFFFFFFFFFF"


Then LabView would silently fail to reflect the elements in the class.

For some reason, if you instead declare it as "ALL = 18446744073709551615", then LabView works.


Can somebody verify this behavior and post some feedback, please?


0 Kudos
Message 3 of 5

Missed one thing:

The problem is that LabVIEW doesn't show any .NET class methods.


protocol_alpha (the originator of this thread) couldn't select any enum values.

But in my case all the methods are invisible in LabVIEW.



0 Kudos
Message 4 of 5

I'm having the exact same issue using VS2017/VS2019 and LabView 2015-32Bit/LabView 2017-64Bit. 

Some help on this issue would be helpful, thanks.

0 Kudos
Message 5 of 5