Guys,
I am writing a program and I want the program to support plugins. I created an interface that the program must implement. I am using the following code from my main program to call the plugin:
Dim asm As Assembly = Assembly.LoadFrom(ff.FullName)
' Get the type
Dim myType As System.Type = asm.GetType(asm.GetName.Name + "." + asm.GetName.Name)
' If the type is null then we try again without the root namespace name
If myType Is Nothing Then myType = asm.GetType(asm.GetName.Name)
' Check to see if the plugin implements the required Interface
Dim IsMyPlugin As Boolean = GetType(LGInterfaces.ILGSQLPlugin).IsAssignableFrom(myType)
Dim ActivePlugin As New PluginObject()
If IsMyPlugin Then
ActivePlugin.Plugin = CType(Activator.CreateInstance(myType), LGInterfaces.ILGPlugin)
Every thing works and I am able to access my exposed properties, except for one problem I can not figure out. In my plugin, I use the following code to expose a property:
Private m_PanelObject As Windows.Forms.Control
Public Property PanelObject() As Windows.Forms.Control
Get
Return m_PanelObject
End Get
Set(ByVal value As Windows.Forms.Control)
m_PanelObject = value
End Set
Ok, so I set this property from my main program and everything works. Except, after a while, m_PanelObject gets set to Nothing for some odd reason. I'm not setting it to Nothing anywhere in my program and there is no place in the plugin code that sets it to Nothing. So what am I missing here? I am sure this will be pretty obvious. Thanks in advance