I have a web app that needs to load plugins. This is not a high-traffic web-site. I have an assembly (myproxy.dll)with a proxy class(inherits from MarshalByRefObject). This proxy assembly only references the System assembly. I added the proxy assembly as a reference to the web application dll (webapp.dll). So I have:
webapp.dll:
references myproxy.dll and other system dlls
myproxy.dll assembly:
references System assembly and nothing else
From webapp.dll (default appdomain), I attempt to run the following code:
Dim dom As AppDomain = Nothing
Try
dom = AppDomain.CreateDomain("PluginProxy_Domain")
Dim proxy As PluginProxy.ProxyClass = _
CType(dom.CreateInstanceAndUnwrap(GetType(PluginProxy.ProxyClass).Assembly.FullName, _
GetType(PluginProxy.ProxyClass).FullName), PluginProxy.ProxyClass)
proxy.callProxyMethod(PluginFile, AssemblyName, TypeName)
Catch ex As Exception
Finally
If IsNothing(dom) = False Then
AppDomain.Unload(dom)
End If
End Try
If I run the code seen above, an exception is thrown (iam running under the debugger)indicating that webapp.dll could not be found. Why is the CreateInstanceAndUnwrap call trying to load the webapp.dll? I do not reference that dll from the proxy assembly (no dependencies on webapp.dll). I am confused at the moment. Any help would be great. Thanks.