NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access the value of a .NET Object Reference Variable

Solved!
Go to solution

Hi Doug,

 

there's no difference if I use "GetValVariant" or "GetValInterface", both return the exact same object. I am sure that this object is the reference to the Bitmap. In the code below, both "try" - "catch" expressions throw the same exception cited in my post above.

Clipboard01.jpg

Serializing the bitmap within the appdomain, i.e. from within the Teststand sequence file using the same TS_Helper.Serializer.Serialize call, works fine and is exactly the workaround that I am using at the moment. It's still only the second best solution, since serialization of a bitmap is not the only thing I'd like to do, and some of those things are not possible from within the sequence file. And I can't see why I can't get the original object instead of the "System.Runtime.Remoting.Proxies.__TransparentProxy" thing, which is close but not quite right.

 

0 Kudos
Message 11 of 12
(368 Views)

You are getting a proxy because Bitmap is derived from MarshalByRefObject so that when it is passed across appdomain boundaries, that is what you get. When passing an object across appdomains, there are two possible choices, serialize it (in which case you have a copy, not the original), or create a proxy to it that forwards calls into the other appdomain by deriving the class from MarshalByRefObject (which is what the Bitmap class currently does). This is not a TestStand issue, this is a .NET appdomain issue. In general, passing objects across appdomains is tricky and has many issues such as object lifetime for proxies that you then have to deal with.

0 Kudos
Message 12 of 12
(361 Views)