在MEF由于缺少组件反序列化错误组件、错误、序列化、MEF

2023-09-05 02:47:46 作者:烟、已淡无味

我使用MEF。余序列它依赖于加载组件之一的对象之一。

I'm using MEF. I serialize one of the objects which relies on one of the loaded assemblies.

现在,当我尝试反序列化这个对象它会抛出无法找到程序集异常。 MEF加载该程序集反序列化的另一课前(我认为这个范围是应用广泛,它加载成一个公共财产的)。

Now when I try to deserialize this object it throws "Unable to find assembly" exception. MEF loads the assemblies before this deserialization in another class (I assume that the scope of this is application wide, it loads them into a public property).

由于MEF已经加载这些程序集的应用领域,为什么 BinaryFormatter.Deserialize()无法找到他们呢?

Since MEF has already loaded these assemblies to the application domain why BinaryFormatter.Deserialize() can't find them?

我可以使用 System.Reflection.Assembly.Load 但是那有什么用MEF的地步? MEF已经为这个有特殊的支持?

I can use System.Reflection.Assembly.Load but then what's the point of using MEF? Has MEF got special support for this?

推荐答案

目前组装探测的伎俩,但我仍然不知道这是最好的做法,因为我还是绕过MEF在这里是没有好处的。

For now assembly probing did the trick, although I'm still not sure if this is the best practices because I still bypasses MEF in here which is no good.

我仍在测试,虽然,看看是否有副作用或类似的东西。这些,我需要加载的DLL相同两次明显的缺点的

 
精彩推荐
图片推荐