Question
· Dec 21, 2020

Passing IRISObject into function as parameter


 We are using Native .NET API from IRISProviderCore21 package, inside .NET Core app, and having issue when trying to call function that takes instance of the class as parameter. The server is IRIS 2020.1.0.217.1

 In a nutshell, the code looks like this:

            // Create instance of the parameter class, proxy object

            var paramObject = iris.ClassMethodObject("MyParameterClass", "%New") as IRISObject;

           paramObject.Set("property", "value");

           var irisResult = iris.FunctionObject("MyFunction", "MyRoutine", paramObject);

  at last line, we are getting exception 
 
 'Unsupported type: InterSystems.Data.IRISClient.ADO.IRISObject'

   at InterSystems.Data.IRISClient.ADO.IRIS.setReference(Object topRef1, String topRef2, Boolean bLimitTypes, Boolean honorByReference, Boolean includeArgumentCount, Object[] subRefs)
   at InterSystems.Data.IRISClient.ADO.IRIS.setClassMethodReference(String className, String methodName, Object[] arguments)
   at InterSystems.Data.IRISClient.ADO.IRIS.RoutineCommon(String labelName, String routineName, String returnType, Object[] args)
   at InterSystems.Data.IRISClient.ADO.IRIS.FunctionObject(String functionName, String routineName, Object[] args)

 

The calls with regular strings / numbers parameters are working just fine, with proper returned IRISObject with data.

    var irisResult = iris.FunctionObject("MyFunction", "MyRoutine", "parameter1", 2);

Need a help. New to .NET + Cache combo

Product version: IRIS 2020.1
Discussion (2)0
Log in or sign up to continue

 In disassembler,

 it looks like the problem is here:

                        if (connection.ConnectionInfo.protocolVersion < 58 || !connection.IsGateway)
                        {
                            throw new ArgumentException("Unsupported type: " + obj.GetType());
                        }

IsGateway property is false. How do I turn it to true :) ? Any other, easier way to achieve what I'm trying to do? 
 

@ilya andreyev, first of all, the code excerpt in your description should work.

1) I think something is wrong with the kit you have. You said it's 2020.1.0.217. Is it a released kit or unreleased kit? On kitserver, the latest released kit for 2020.1 is 2020.1.0.215, built on 05/12/2020. Can you give me the full $ZV of your kit?

2) If your disassembler is correct, the line it showed is old. The old line was corrected on 12/13/2019 when that file was still in //iris/latest branch.

The bottom line is, I think, that you have a somewhat strange build, maybe an interim non-released build done before 2020.1 was released, most likely built before 12/13/2019. If that's the case, I think you should just get the latest released version of 2020.1, which is 2020.1.0.215. You original code should work in that kit.