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]
May be an issue with the type resolution...use the complete type name (including the namespace). Some code sample might help!
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
(fromList[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 thebin
folder. But I also dynamically load one of the referenced assemblies from it's original build location.