I have a .NET class that wraps the Internet Explorer API. All of my methods are working except one. I have one method that crashes with the exception:
Specified cast is not valid.
Source: mscorlib at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32 aWrapperTypes, MessageData& msgData)
at IEAutomation.IEWrapper.GetPTCStatusValueCell(String statusName)
at IEAutomation.IEWrapper.GetPTCStatusValue(String statusName)
Here's the kicker though, if I call this same method from another app on the same machine for the same webpage using the same values there are no errors.
Anyone have ideas?
I have a few questions that will help me address your issue:
Thank you for replying.
I was able to (just a few minutes ago) determine the issue. I honestly do not fully understand it but the problem is in the call to the COM method. To resolve the issue I make the call on a separate thread and it works fine. I believe it has something to do with the security surrounding frames but why the call worked from other applications I am not sure.