Error -29038 When Working with NI Switch Executive and TestStand

Updated Oct 2, 2024

Reported In

Software

  • Switch Executive
  • TestStand

Issue Details

When working with NI Switch Executive Virtual Devices in TestStand, I receive Error Code -29038 saying, "NISE_ERROR_INVALID_IVI_SESSION".  The error states that it has to do with an invalid IVI device session.  How do I prevent this error from occurring in the future?

Solution

This error means that you tried to access an Invalid IVI device session. This can occur if you simultaneously opened multiple NI Switch Executive Virtual device sessions that use the same IVI device. At runtime, an IVI device can only be used by one Virtual Device.

One of the following workarounds may help you avoid the NISE_ERROR_INVALID_IVI_SESSION error:

  1. In TestStand, use the TestStand ActiveX Adapter steps to get and close each Virtual Device session before opening the next Virtual Device session. You can close a Virtual Device runtime session in TestStand by calling two ActiveX Adapter steps, one to get the session from the NI Session Manager, InstrSessionMgr().GetInstrSession(VirtualDeviceName), and the other to close the session, SessionObject.Close(). TestStand will later reopen the session on the next step that uses that Virtual Device. See attached sequence file, CloseVirtualDevice.seq, for an example.
  2. In Measurement & Automation Explorer (MAX) reconfigure your Virtual Devices so that each IVI device is used by only one Virtual Device.
  3. In MAX, reconfigure your Virtual Devices into one Virtual Device.