I knew it wasn't really an MEF issue but I figured I could get some help in figuring out where to destroy the objects so they aren't alive anymore without causing some other kind of issue. Here is the code I am currently using the compose the object.
<Import()> Public propertySheets As ExportCollection(Of PropertySheetControl)
Dim oadhelper As ActiveDirectoryHelper 'Active directory helper in c#
Dim assemblyCatalog As AssemblyCatalog
Dim directoryCatalog As DirectoryCatalog
Dim container As CompositionContainer
Dim batch As CompositionBatch
I have the code above defined at the top of my class.
assemblyCatalog = New AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly())
container = New CompositionContainer(New DirectoryCatalog("C:\plugins"))
batch = New CompositionBatch()
Catch ex As CompositionException
MsgBox(ex.Errors.ToString, MsgBoxStyle.Critical, "Error")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error")
I have the above code being called after Initialize(). The MEF objects are controls of inherited type UserControl.
<ExportMetadata("User", "")> _
Public Class ExchangeUserPropertySheet
The above code is at the top of the class for the controls that I am using MEF to self discover and load. Hopefully this may help a little bit in working towards a solution. Again, thanks for your help. If you have any questions I am watching
this forum pretty heavily so I'll be back to answer for sure.