|
-
Jul 3rd, 2002, 03:17 AM
#1
Thread Starter
New Member
Problem with appdomain ! I need help !
I need to load and unload dynamically a .dll (assembly previouly created) into a newly domain.
I've read many things concerning the appdomain class and assembly class. I've build a little app to show you my problem.
Here are the code for the plugin.dll assembly :
Public Class test
Public Sub New()
'
End Sub
Public Sub DoJob()
' Do some work
End Sub
End Class
Here are the code for the test.exe console assembly :
Imports System.Reflection
Module Module1
Private mPluginDomain As AppDomain
Private moObjectInterface As Object
Sub Main()
Dim a As [Assembly]
mPluginDomain = AppDomain.CreateDomain("Domain_plugin.test", _
AppDomain.CurrentDomain.Evidence, _
AppDomain.CurrentDomain.SetupInformation)
a = mPluginDomain.Load("plugin")
moObjectInterface = a.CreateInstance("plugin.test")
a = Nothing
moObjectInterface.dojob()
moObjectInterface = Nothing
AppDomain.Unload(mPluginDomain)
mPluginDomain = Nothing
MsgBox("end")
End Sub
End Module
Here are the resulting log :
...
'Domain_plugin.test' : chargé 'c:\temp\tst\bin\plugin.dll', symboles chargés.
'tst.exe' : chargé 'c:\temp\tst\bin\plugin.dll', symboles chargés.
...
Everything works ... exept one thing ! The plugin.dll is loaded twice ! One in the remote domain, and one in the default appdomain. The result is that I can't update my plugin.dll with a new code because the file is still use by the process.
Can someone help me resolving this problem ?
PS : Sorry for my bad english !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|