From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET method call crashes in TestStand but nowhere else

Hi All,

 

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 mshtml.HTMLDocumentClass.get_frames()
   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?

 

0 Kudos
Message 1 of 4
(2,827 Views)

Forsetti,
I have a few questions that will help me address your issue:

 

  1. What environment did you create the .NET class in that you are using?
  2. Could you provide the source and compiled .NET class that you are using?
  3. Could you attach the source code for the function you are calling that is wrapping the Internet Explorer API?
  4. How are you sending the arguments to this function from TestStand? (Screenshot would be most helpful)
  5. What other application are you calling this from that does work? How are you setting up the arguments in this other application?
Jared A.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,805 Views)

.

0 Kudos
Message 3 of 4
(2,802 Views)

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.

 

 

0 Kudos
Message 4 of 4
(2,799 Views)