AppDomain and delegate... How?????

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • José Joye

    #1

    AppDomain and delegate... How?????

    I have created a new AppDomain from within my window Service.
    I need to pass some delegates to an instance of a class loaded in the other
    appDomain.

    With the way I currently do it, the delegates get called. HOWEVER, in the
    second appDomain and not
    in my main AppDomain.
    The class that contains the delegates is derived from MarshalByRefObj ect.

    Heeeeeelp!
    Thanks :-)




    ========Snippet of my code =============
    // ...
    AppDomain gAppDomain;
    gAppDomain = AppDomain.Creat eDomain ("FileAcquistio nRamitAppDomain ", null,
    setup);
    Object o = gAppDomain.Crea teInstanceAndUn wrap(
    Assembly.GetExe cutingAssembly( ).FullName,

    typeof(RamitRec eiveWrapper).Fu llName);

    // local object to access object located in other AppDomain
    RamitWrapperApp Domain = (FileAcquisitio n.RamitReceiveW rapper)o;

    //
    // initialize callbacks for customized treatments /// <----- here I pass
    my delegates
    //
    gcbProcImg = new RamitReceiveWra pper.FProcImg(F ileReceiver.Sto reImage);
    gcbExitRamit = new RamitReceiveWra pper.FExitRamit (FileReceiver.E xitRamit);
    RamitWrapperApp Domain.DefineRa mitDelegates(re f gcbProcImg, ref
    gcbExitRamit);
    //...


  • José Joye

    #2
    Re: AppDomain and delegate... How?????

    Found it!

    Method passed in delegate should not be declared static.

    José
    "José Joye" <jose.joye@KILL THESPAMSbluewin .ch> wrote in message
    news:u39G2E5oDH A.2528@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I have created a new AppDomain from within my window Service.
    > I need to pass some delegates to an instance of a class loaded in the[/color]
    other[color=blue]
    > appDomain.
    >
    > With the way I currently do it, the delegates get called. HOWEVER, in the
    > second appDomain and not
    > in my main AppDomain.
    > The class that contains the delegates is derived from MarshalByRefObj ect.
    >
    > Heeeeeelp!
    > Thanks :-)
    >
    >
    >
    >
    > ========Snippet of my code =============
    > // ...
    > AppDomain gAppDomain;
    > gAppDomain = AppDomain.Creat eDomain ("FileAcquistio nRamitAppDomain ", null,
    > setup);
    > Object o = gAppDomain.Crea teInstanceAndUn wrap(
    > Assembly.GetExe cutingAssembly( ).FullName,
    >
    > typeof(RamitRec eiveWrapper).Fu llName);
    >
    > // local object to access object located in other AppDomain
    > RamitWrapperApp Domain = (FileAcquisitio n.RamitReceiveW rapper)o;
    >
    > //
    > // initialize callbacks for customized treatments /// <----- here I[/color]
    pass[color=blue]
    > my delegates
    > //
    > gcbProcImg = new RamitReceiveWra pper.FProcImg(F ileReceiver.Sto reImage);
    > gcbExitRamit = new RamitReceiveWra pper.FExitRamit (FileReceiver.E xitRamit);
    > RamitWrapperApp Domain.DefineRa mitDelegates(re f gcbProcImg, ref
    > gcbExitRamit);
    > //...
    >
    >[/color]


    Comment

    Working...