为什么我得到这个.NET错误 - "类型错误:预期列表[数据点],得到列表[数据点] QUOT; [英] Why do I get this .NET error - "TypeError: expected List[DataPoint], got List[DataPoint]"

查看:204
本文介绍了为什么我得到这个.NET错误 - "类型错误:预期列表[数据点],得到列表[数据点] QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我重构一些代码,现在我调用函数时得到这个错误。但一切似乎,我甚至比 failing_argument.GetType()要罚款。AssemblyQualifiedName 旧的和新的代码之间和他们是一样的。任何想法可能是错误的?



函数的调用是在IronPython的代码,功能是在C#代码(这个重构过程中没有改变的组装)



什么样的​​事情可能会产生这个错误



编辑:全IronPython的回溯:

 回溯(最近通话最后一个):
档D:\Work\Framework\python\ide\ tab_manager.py57行,在add_chart_tab
chart_tab = ChartTab(个体经营.__ main_window,自我,tab_item,姓名,chart_descriptor)
档D:\Work\Framework\python\ide \chart_tab.py64行,在__init__
自.__图=图(自我,自我.__ gui_cfg,自我.__ base_cfg,自我.__ chart_descriptor,自我.__ scroll_bar)
档D:\ Work\Framework\python\ide\chart.py57行,在__init__
self.update_topology(空= FALSE)
档D:\Work\Framework\ python\ide\chart.py,线路93,在update_topology
self.update_config()
档D:\Work\Framework\python\ide\chart.py 111行,在update_config
自.__ global.chart_view = ChartView(个体经营.__全局)
档D:\Work\Framework\python\ide\chart_view.py第33行,在__init__
自.__跨度= SpanUtil.compute_spans(time_series,gap_threshold)
类型错误:预期列表[数据点],得到列表[数据点]


解决方案

在进一步调试我设法从代码中的一个不同的错误信息:无法投类型的对象列表[数据点]'到'清单[数据点]



搜索这产生了几篇文章说明问题:结果
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 结果



原来,包含程序集数据点(从列表[数据点] ),它是从两个不同的位置我的应用程序加载的两倍。在我的情况的原因是,当Visual Studio中建立一个程序集,它也将所有其他引用的程序集旁边新建一个在文件夹中。但我也动态加载从它引用的组件之一的原始版本的位置。


I refactored some code, and now I get this error when calling a function. But everything seems to be fine, I even compared failing_argument.GetType().AssemblyQualifiedName between the old and the new code and they are the same. Any ideas what could be wrong?

The invocation of the function is in IronPython code, the function is in C# code (an assembly which didn't change during this refactoring).

What sort of thing could generate this error?

EDIT: full IronPython traceback:

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]

解决方案

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.

这篇关于为什么我得到这个.NET错误 - "类型错误:预期列表[数据点],得到列表[数据点] QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆