switch appdomain inside a callback method

  • Thread starter Thread starter h_schmieder
  • Start date Start date
H

h_schmieder

Guest
Hello we have the following code


string MyCallbackCore(string instring)
{
string result = string.Empty;

// code to get result using instring

return result
}

// this method could be called inside apddomain with id 1
string MyCallback(string instring)
{
if (AppDomain.CurrentDomain.Id != 2)
{
string transferedResult = string.Empty;
// <--- Begin Don't know

/*
switch to appdomain 2 and transfer instring to appdomain 2

call MyCallbackCore with transfered instring

switch to appdomain 1 and transfer result of MyCallbackCore to transferedResult;


// <--- End Don't know

return transferedResult;
}
else
{
return MyCallbackCore(string instring)
}
}


We have Situation where MyCallback is called form a method which is in inside appdomain 1,

so we have to switch to appdomain 2 before calling MyCallbackCore. (See the comments in the if banch).

Can somebody gives some hints what to use inside the if branch ?

tia

Hendrik Schmieder

Continue reading...
 
Back
Top