Domanda

We're building an application that supports plug-ins (which must import/export certain interfaces defined by us) written by third party developers. We're planning to use MEF to detect the presence of these plug-ins in a specified directory.

What level of control can I impose on plug-in developers to minimise the possibility that badly written components can cause memory leaks (affecting stability) and/or hog the processor (affecting performance) of our host application?

I have used tools such as ANTS memory and performance profiling applications to track down and diagnose problems when they occur, but it may not always be possible to do this given that the application may be running in environments over which we have no control.

È stato utile?

Soluzione

What level of control can I impose on plug-in developers to minimise the possibility that badly written components can cause memory leaks (affecting stability) and/or hog the processor (affecting performance) of our host application?

You would have to load the plugins in a separate child process, and then communicate with that process via WCF or some other form of IPC. That way you could monitor resource usage and kill the plugin if necessary.

MEF doesn't help you with this. But perhaps it might be possible to write your own ExportProvider implementation which handles some or all of that.

edit: The IsolatingCatalog by Piotr Włodek look promising.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top