NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

access .net static functions from teststand

Hi,
 
I have a .Net DLL whose constructor is private. So basically we can create an object of the class using a get property. When i try accessing this get property/method from TestStand, the dll is not called at all and i get the following runtime error:
 
"The object specified in the class reference is not a .NET object.
Since you are not creating an object, this must be a .NET object."
 
Error code: -17300; Value invalid or out of range.
 
Kindly help me out with this!!
 
Thanks in advance,
Priya.
0 Kudos
Message 1 of 5
(4,185 Views)
Do you have the Create Object checkbox checked?  It's in the Specify Module for your step.


Message Edited by ~jiggawax~ on 03-03-2008 11:08 AM
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 5
(4,174 Views)

Hi,

Thanks for your reply. But its a singleton class so the constructor is private. As the constructor is private "create object" checkbox is disabled in Teststand. The .Net code looks somewhat like this:

Class Person

{

  private static Person m_objectA = new Person();

  private Person() { }

  public static Person person

  {

      get { return m_objectA; }

   }

}

 

I need to access the "person" get method and get the object "m_objectA". . Kindly tell me how to do it.

Thanks,

Priya.

 

0 Kudos
Message 3 of 5
(4,160 Views)
Priya,

I was able to use your code and access the property without any problems.  I am using 4.0.1f1.

Do you have anything specified in the "Object Reference" field?  This needs to be blank for static methods and properties since you do not have an object to call the function on.  I get a similar error if I specify an object for that field.

Allen P.
NI
0 Kudos
Message 4 of 5
(4,152 Views)

Hi Allen,

oh yaa..that was the problem..I was giving a variable in object reference.

Thanks for ur reply.

Priya.

 

0 Kudos
Message 5 of 5
(4,119 Views)