为什么我会收到此.NET错误 – “TypeError:expected List ,得到List ”

我重构了一些代码,现在我在调用函数时遇到了这个错误。 但是一切似乎都很好,我甚至比较了旧代码和新代码之间的failing_argument.GetType().AssemblyQualifiedName ,它们是相同的。 什么想法可能是错的?

函数的调用是在IronPython代码中,函数是在C#代码中(在重构过程中没有改变的程序集)。

什么样的事情会产生这个错误?

编辑:完整的IronPython回溯:

 Traceback (most recent call last): File "D:\Work\Framework\python\ide\tab_manager.py", line 57, in add_chart_tab chart_tab = ChartTab(self.__main_window, self, tab_item, name, chart_descriptor) File "D:\Work\Framework\python\ide\chart_tab.py", line 64, in __init__ self.__chart = Chart(self, self.__gui_cfg, self.__base_cfg, self.__chart_descriptor, self.__scroll_bar) File "D:\Work\Framework\python\ide\chart.py", line 57, in __init__ self.update_topology(empty=False) File "D:\Work\Framework\python\ide\chart.py", line 93, in update_topology self.update_config() File "D:\Work\Framework\python\ide\chart.py", line 111, in update_config self.__global.chart_view = ChartView(self.__global) File "D:\Work\Framework\python\ide\chart_view.py", line 33, in __init__ self.__spans = SpanUtil.compute_spans(time_series, gap_threshold) TypeError: expected List[DataPoint], got List[DataPoint] 

经过进一步调试后,我设法从代码中获取了一条不同的错误消息: Unable to cast object of type 'List[DataPoint]' to 'List[DataPoint]'

搜索这个产生了几篇解释这个问题的文章:
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

事实certificate,包含DataPoint的程序集(来自List[DataPoint] )在我的应用程序中从两个不同的位置加载了两次。 我的原因是,当Visual Studio构建一个程序集时,它还会复制bin文件夹中新构建的程序集旁边的所有其他引用程序集。 但我也从它的原始构建位置动态加载其中一个引用的程序集。

可能是类型解析的问题…使用完整的类型名称(包括命名空间)。 一些代码示例可能有帮助!