vendredi 10 novembre 2017

handle exception generated by a function of a plugin instance created with Activator.CreateInstance

I'm developing an application that is extensible throught plugin. When a plugin instance is needed i'm creating it using the Activator.CreateInstance.

In the code below pluginInst is an instance of a test plugin created with Activator.CreateInstance and testException() is a plugin function that now simply throw an exception.

Try
    pluginInst.testException()
Catch ex As Exception
    Console.WriteLine("plugin exception generated")
End Try

The message never appears in the output window of visual studio, and if i put a breakpoint in the catch it never goes there. The plugin instance crash but the main application keep running normally. The only thing that i see is this message on visual studio output window

Eccezione generata: 'System.Exception' in testPlugin.dll

How i can handle plugin exceptions like this in main application? What i'm doing wrong?





Aucun commentaire:

Enregistrer un commentaire