MethodInfo.Invoke called process: possible to stop run?

F

florian.grimps

Hi.

I'm trying to implement some kind of plugin manager and call functions
in remote loaded libraries in seperate AppDomains to be able to unload
the DLLs) via MethodInfo.Invoke(). So far, so fine. But I call some
long running functions this way an want to stop this calls, but have
no idea how to do this. Is it possible and how, or should I use a
different approach?

Thanks in advance,
Florian
 
N

Nicholas Paldino [.NET/C# MVP]

Florian,

If your methods have no hooks in them which allow them to receive a
signal, then you will have to execute those methods in another thread, and
then abort the thread.
 
J

Jon Skeet [C# MVP]

I'm trying to implement some kind of plugin manager and call functions
in remote loaded libraries in seperate AppDomains to be able to unload
the DLLs) via MethodInfo.Invoke(). So far, so fine. But I call some
long running functions this way an want to stop this calls, but have
no idea how to do this. Is it possible and how, or should I use a
different approach?

It's better to do this co-operatively, via a plugin interface which has
a method to tell the long-running tasks that you wish to stop. That way
they will be able to shut down gracefully, cleaning up resources etc.
 
F

florian.grimps

Nicholas Paldino [.NET/C# MVP]
It's better to do this co-operatively, via a plugin interface which has
a method to tell the long-running tasks that you wish to stop. That way
they will be able to shut down gracefully, cleaning up resources etc.


The approach to use a plug-in interface to co-operatively
abort sounds good to me, I try to work this out.

Thanks a lot for your fast responses,
Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top