Why do I get this .NET error - “TypeError: expected List[DataPoint], got List[DataPoint]”

拥有回忆 提交于 2019-11-29 17:59:45

After further debugging I managed to get a different error message from the code: Unable to cast object of type 'List[DataPoint]' to 'List[DataPoint]'

Searching for this yielded a couple of articles explaining the problem:
http://www.infinitec.de/post/2008/05/InvalidCastException-Unable-to-cast-object-of-Type-X-to-X.aspx
http://geekswithblogs.net/rupreet/archive/2010/02/16/137988.aspx

It turns out that the assembly containing DataPoint (from List[DataPoint]) it's loaded twice in my application from two different locations. The cause in my case is that when Visual Studio builds an assembly, it also copies all the other referenced assemblies next to the newly built one in the bin folder. But I also dynamically load one of the referenced assemblies from it's original build location.

May be an issue with the type resolution...use the complete type name (including the namespace). Some code sample might help!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!