From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

A null reference was used to retrieve an object

 
I have a dll containing a static class, that contains static methods, that in turn call functions from another dll.
 
I get the error:
 
"An error occurred within the .NET code.
You are not creating an Object and the class reference given has not been set to an object.
A Null reference was used to retrieve an object.
Error Code: -17500"
 
Does this mean anything to anybody ?
 
ps.
I dont need to create an object because the class is static, and all the methods contained within this static class are also static.
Also, the class appears as "not creatable" in teststand (because it is static)
 
So this error must be a bug in teststand.
 
 
 
 
 
 
 
 
 
 
0 Kudos
Message 1 of 5
(3,729 Views)
penguinman,

Have you tried putting some try/catch statements inside your code? This error has come up a few times before in the past and has usually been resolved inside of the .NET code rather than the TestStand step and I have not been able to find any bug reports for this type of error from TestStand.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 5
(3,708 Views)

Are their any updates to this topic?

 

In TestStand, we are trying to make a .NET step to use some code that we wrote to control a serial device. This is the first .NET step in the sequence. In the in Module Step settings tab the Root Class pull down shows the name of the object that I was expecting but followed by (not creatable), see attached.

 

We are not seeing the errors as mentioned in the post above.

 

What is the significance of the “not creatable” message? This sequence step and others work. Is there something wrong, should we be doing something different?

 

We are using TestStand 2013, 5.1.0.240 with Microsoft Visual Studio 2012 and .NET 4.0.

 

Thanks

0 Kudos
Message 3 of 5
(3,106 Views)

Not createable just means that there is no way to construct an object of that type (i.e. no public constructors), but that doesn't matter if you are just calling static methods. Is there a problem you are trying to solve? If you just want to call static methods on the class you should be fine. I believe the original forum poster was seeing an entirely different issue. The .NET adapter was a lot different back in 2007.

 

Hope this helps.

-Doug

0 Kudos
Message 4 of 5
(3,088 Views)

Doug

Thanks for your explanination.

Since we are just calling static methods, there is no problem then.  The indication of "not creatable" just took me by surprise and I wanted to know if we were doing something wrong.  The code is working.

Chuck

0 Kudos
Message 5 of 5
(3,081 Views)