Developer Center Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

.net constructor node does not show constructors when I have public class properties in my dll

I am using LabVIEW 8.5 and .NET 2.0.

I am trying to use .net constructor node to call methods in a dll I created using C#.  I find that if I have any public properties which I initialize at compile time, none of the public constructors show up in the "Select .NET Constructor" dialogue box.


My .net class looks something like the following:

------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace MyNameSpace{
    public class MyClass
    {

        public delegate void MyEventHandler(object sender, double value);

        public event MyEventHandler NewEvent;

        public string myProperty = "some value";

        public string MyFirstMethod(int myFirstParam,  string mySecondParam, int myThirdParam)

        {

               // do some stuff

        }

        public int MySecondMethod()

        {

               // do some more stuff

        }

     }

}

------------------------------------------------------------------------------------

If I take out the

          public string myProperty = "some value";

or if I change it to --

           public string myProperty;

the constructor node behaves normally and detects all of the public constructors.  Is this a "feature" of .NET constructor nodes in LabVIEW?

I would just initialize it in a constructor, except that I am trying to do some minimal error logging in the dll and there are a couple of constants I need to declare in my class, so I cannot move those to the constructor; they must be defined at compile time.

Thank you in advance for your help.

0 Kudos
Message 1 of 2
(5,283 Views)

Hi Protocol Alpha,

I haven't been able to reproduce the problem you describe...

I basically created a blank "Class Library" project in both Visual Studio 2008 and Visual Studio 2005 and pasted your code into it. I tried the resulting assemblies from both LabVIEW 2009 and LabVIEW 8.5, and was able to call the constructor and see the property of the class.

I've attached my code to this post. If you are still having problems, can you please attach both the source code (entire project/solution) as well as a compiled assembly?

Thanks,

Jervin Justin

Jervin Justin
NI TestStand Product Manager
Download All
0 Kudos
Message 2 of 2
(3,334 Views)