This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

When using the ExecuteScalar method to execute a SmartObject from SmartObjectClient API, an error occurs as below.

"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

Symptoms

This error appears when call ExecuteScalar is followed by ExecuteList in sequence within a SINGLE SmartObjectClientServer connection.

Image

Troubleshooting Steps

A workaround for this is to create a new SmartObjectClientServer connection for each ExecuteScalar and ExecuteList call.