NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Same AppDomain when using a Engine.NewExecution

Solved!
Go to solution

Hi everyone,

 

I looked at the forum but I dont see any solution about it.

 

Right now, Im running sequence file through the TestStand Engine from a custom c# application we made. My problem is My C# application and the TestStand execution dont share the same AppDomain.

 

Is there a way to, when I load th TestStand.Engine, share the same AppDomain between them.

 

Thank you

 

I hope I was clear about my issue. Is there something, let me know, I will add more details.

 

Ross

 

 

0 Kudos
Message 1 of 3
(3,128 Views)

Hi M.Ross,

 

I do not believe this is possible due to the execution being run as part of the Teststand process in its own AppDomain and not part of your application's execution.  If my understanding of AppDomains is correct, a process may have multiple AppDomains which contain separate threads, but an AppDomain cannot be shared between processes.  What are you trying to accomplish by having them run in the same AppDomain?

Justin D
Applications Engineer
National Instruments
http://www.ni.com/support/
0 Kudos
Message 2 of 3
(3,110 Views)
Solution
Accepted by topic author M.Ross

You can't currently make the executions use the same appdomain as your UIs, however you can share .NET objects between the appdomains if they are derived from MarshalByRefObject or are serializeable (serializeable objects are copied rather than passed as a reference). If you are using TestStand 2010 or higher (and this might work in older versions too, but I'm not 100% sure), you can then pass the object between appdomains using a TestStand Object Reference variable. You can use a StationGlobal or other variable that is accesible from both locations. Call SetValInterface from one, and GetValInterface from the other. The assembly containing these shared objects must also either be in the GAC, or in your application's base path (i.e. the directory of the exe) or you will get errors.

 

Hope this helps,

-Doug

0 Kudos
Message 3 of 3
(3,105 Views)