Я получаю исключение ниже при бросании объекта как IEnumerable.System.InvalidCastException: Невозможно передать COM-объект типа «System .__ ComObject» в тип интерфейса «System.Collections.IEnumerable»
Это часть моего проекта автоматизации, который был построен с использованием VS2008 и предназначен для работы на IE8, теперь я пытаюсь использовать VS2010 и работать на IE9.
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Collections.IEnumerable'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{496B0ABE-CDEE-11D3-88E8-00902754C43A}' failed due to the following error: 'No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))' and the COM component does not support IDispatch::Invoke calls for DISPID_NEWENUM.
HTMLDocument doc = some htmldocument
IHTMLElement ele = doc.getElementById("some property");
int iTab = (int)ele.getAttribute("someproperty", 0);
object oTab = ele.getAttribute("property", 1);
IEnumerable xyz = (IEnumerable)oTab;
System.Collections.IEnumerator index = xyz.GetEnumerator();
Он работал с IE8 и anyreason, котор он может терпеть неудачу с IE9 – user3331045
Я проверил его снова, тот же самый код работает с IE8 но на IE9 я получаю ошибку. – user3331045