App domains

  • Thread starter Thread starter Murray Foxcroft
  • Start date Start date
M

Murray Foxcroft

Manoman, what a headache,

I am trying to run some code in a separate Application Domain (in C#)

I need to load an assembly (.DLL) and run it in a separate memory area
(Appdomain) as I have a service that calls some rather unreliable code. If
this code fails, I want it cleaned up as extensively as possible but the
service must still attempt again at the next polling interval.

I can get simple samples to work in a rather convoluted manner, more complex
samples where the called class inherits from a base class etc just dont want
to play along and give Invalid Cast Exceptions.

Does anyone that has burnt on this before have some C# code for me that.

1) Creates an AppDomain
2) Loads an Assembly (.NET) DLL
3) Runs a method in that assembly
4) Shuts down / Unloads the application domain.

Thanks in advance
 
Hi,

I've used AppDomains quite extensively, but I don't remember any problems
with inherited classes. You should of course ensure the assembly containing
the type which is either passed across domains or a type participating in
cross-domain calls is loadable from both of the domains.
 
Back
Top