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.

Reply via email to