Hi.

the interesting parts here is, I had modified Shawn's sample.
and change the memberVar as static.

result is still "7"

that means , your second Domain had copied this object .
and change it in that Domain .
but in first Domain .
still the same.

your could see something in .NET Remoting .

Polo Lee

> To have your object - and not a different one - _refered_ to by the
> other app domain, you have to pass it by _reference_
>
> You can either extend MarshalByRefObject or implement your own
> marshalling. :-)
>
> Charlie Poole
> [EMAIL PROTECTED]
> www.pooleconsulting.com
> www.charliepoole.org
>
>
>
>> -----Original Message-----
>> From: Moderated discussion of advanced .NET topics.
>> [mailto:[EMAIL PROTECTED]]On Behalf Of Shawn A. Van
>> Ness
>> Sent: Sunday, December 15, 2002 12:59 AM
>> To: [EMAIL PROTECTED]
>> Subject: [ADVANCED-DOTNET]
>> AppDomain.DoCallback(CrossAppDomainDelegate) bug?
>>
>>
>> v1.0.3705...  I just tried sending a delegate, bound to a
>> serializable/mbv instance, to AppDomain.DoCallback.  I was
>> surprised to find that my object was only transmitted [in] to the
>> secondary appdomain, not [in,out].
>>
>> Is there no way to return any info from AppDomain.DoCallback (w/o
>> having Foo extend MarshalByRefObject)?
>>
>> Is this behaviour by design?  It feels unintuitive...  am I
>> missing something?
>> -S
>>
>> using System;
>>
>> [Serializable]
>> class Foo
>> {
>>     public int memberVar = 7;
>>
>>     public void CallbackImplementation()
>>     {
>>         this.memberVar = 13;
>>     }
>> }
>>
>> class MainModule
>> {
>>     static void Main()
>>     {
>>         Foo foo = new Foo();
>>
>>         AppDomain secondaryDomain =
>>             AppDomain.CreateDomain( "secondary domain");
>>
>>         // 'foo' will be serialized and sent across the wire to
>> secondaryDomain,
>>         // where 'foo.memberVar' will be modified.  but how to
>> communicate the
>>         // new value back to our side of the fence?
>>         secondaryDomain.DoCallBack(
>>             new CrossAppDomainDelegate(foo.CallbackImplementation));
>>
>>         Console.WriteLine(foo.memberVar);
>>         // still 7! expected: 13?
>>     }
>> }
>>
>>
>> Cheers,
>> -Shawn
>> http://www.arithex.com/
>>
>> You can read messages from the Advanced DOTNET archive,
>> unsubscribe from Advanced DOTNET, or
>> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>>
>>
>
> You can read messages from the Advanced DOTNET archive, unsubscribe from
> Advanced DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.


---

you should create one design just to throw away.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to