I'm creating a plugin framework with C#. The main requirements of the framework is to load, unload and update plugins at runtime.
To accomplish this I've been creating AppDomains and loading the plugin assemblies into the AppDomains.
Everything works fine on Microsoft .NET on windows but the plugins do not work on mono running on mac or linux.
When trying to start a plugin I get an exception like this:
Cannot cast argument 0 of type 'System.Func`1[[API.Network.NodeType, API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' to type 'System.Func`1[[API.Network.NodeType, API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
This is caused because each plugin has it's own copy of the API.dll assembly, and though the assembly is an identical copy, mono doesn't see the Types as being the same.
How can I get the plugin to load the API.dll from the main application's directory? Or, alternatively, how can I get mono to see the Types as being the same?