I'm writing C# code in Visual Studio. I add the embedded DLL inside the project, I am dynamically loading the assemblies. We use JSON.NET to serialize and deserialize objects with type Context.JobDataObj
, which is defined in one of the embedded DLLs, and passing the DLLs between various programs.
Unfortunately, whenever I attempt to deserialize, I get the following error:
Type specified in JSON 'Context.JobDataObj, HPMContext, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not compatible with 'Context.JobDataObj, HPMContext, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
I'm looked up the error in the source code of JSON.NET, the error refers to IsAssignableFrom
returning false
... When I move the DLL out of the project, the seralization and deseralization works like a charm.
UPDATED:
I've managed to pull in JSON.NET source code and debug it... apparently the only difference between whether it's using the embedded DLL and not is the return value of IsAssignableFrom in the line:
if (objectType != null && !objectType.IsAssignableFrom(specifiedType))
objectType
is equal in every way to specifiedType
, I've checked all its assemblies, types, interfaces, members, etc etc. Does anyone know how IsAssignableFrom
determines it's values?