SetData/GetData doesn't work between AppDomains

I'm using VS2005 and am trying to set a AppDomain property in a new AppDomain prior to launching a program within it. I want to pass in a configuration string which the program can look for.

Here is what I'm currently doing

1. I'm creating an AppDomain2 from the default AppDomain

2. I'm calling SetData and assigning a value for AppDomain2 from the default AppDomain

3. I'm calling ExecuteAssembly for AppDomain2 from the default AppDomain

4. The console application executing in AppDomain2 attempts to retrive the property set by the default domain but it is always empty. Trying to set a value by the program is not avalible to the default AppDomain.

What am I doing wrong? When control returns to the default AppDomain I see that AppDomain2 still has the property set in step 2 but code running in AppDomain2 doesn't appear to be able to access it?

Is there another way of passing information between domains prior to launching a program in AppDomain2?

Thanks,Ty

[1180 byte] By [TyY] at [2007-12-24]
# 2

Thanks for the reference to the new method, it however did not resolve my issue

I actually believe that I found the culprit. I'm actually launching a 3rd party EXE which is expected to load up my library and execute it. I named my appDomain2 and eralized that the actual library is being hosted by a AppDomain_Adaptor. The weird thing is that my main domain has an id of 1 and the appdomain I launched has an id of 2 and the library domain also has an id of 2 but the data doesn't appear to be avalible?

I'm not sure how I can get by this except by passing informatin through a predefined file or channel since I do not own the 3rd party application.

Thanks for you help, Ty

TyY at 2007-10-8 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified