01-28-2010 01:43 AM
Test stand object Reference field- <The expression cannot be empty>
It is showing an error like "The .Net property can not be accessible
Object Reference not set to an instance of an object".
How it can be resolved?
01-28-2010 02:20 AM
If this is the first step in your sequence to interact with the .NET assembly, you have to make sure that the object you want to interact with can be created from an external process (in this case TestStand). Then you have to check the checkbox "Create Object".
hope this helps,
Norbert
01-28-2010 02:35 AM
01-28-2010 02:52 AM
I am not sure about this because i never used another tool than UIs in order to create sequences containing .NET steps (so manually selecting all the stuff).
But looking into the help of TestStand Adapters, you can find the CreateObject property from the DotNetModule-class:
CreateObject Property
Syntax
DotNetModule.CreateObject
Data Type
Boolean
Purpose
Specifies whether to create a new instance of the class.
I think this is worth a try....
Norbert
01-28-2010 02:59 AM
Hi bannerghatta !
Have you ever open and looked into the zip file
from my previous post ?!?
http://forums.ni.com/ni/board/message?board.id=330&thread.id=26979&view=by_date_ascending&page=2
There you can see how the constructor activating is done.
Well my stuff is done in Teststand it self.
If like do this in C#, you only need to copy the calls into your IDE, thats all.
Hope this Helps
Juergen
01-28-2010 03:29 AM
I am using Singleton Class in .Net. So I need not create object in TestStand. The Get property of the class will return its own class object. So the Class Reference should be empty only.
When I
choose the property manually, I am getting this error. This I am getting only
when I create this step through C# TestStand APIs. Please help me to remove this
error in the Class Reference field using TestStand
APIs.
01-28-2010 06:34 AM - edited 01-28-2010 06:35 AM
..And how do you get a refenerce to you class. You like to get/set some properties but from which object ?
where is handle to this class?
What about providing a small TS/VS example
Instead of keeping it in "whiteness" ?
I am sure the "blue ones" or some other members will find an answer/solution to your requirement
Juergen
01-28-2010 09:46 AM
If you specify a static member, the Object Reference field should not show as being required any more. In your post you said "The Get property of the class will return its own class object". This makes it sound like you have a non-static property that literally has "return this;" in it. This obviously will not work because if you can call a non-static member then you must already have the class object. What you need in your singleton is something like this:
private static MyClass sMyClassInstance;
public static MyClass GetMyClassInstance()
{
if (sMyClassInstance == null)
sMyClassInstance = new MyClass();
return sMyClassInstance;
}
Is this how you have it setup?
-Jeff
01-31-2010 11:36 PM
02-09-2010 09:30 AM
So you are saying that once you specify a static member you still see the object reference as saying "<The expression cannot be empty>"? Can you reproduce this in a simple case and attach the source code? Otherwise there's not much I can do...
-Jeff