Article
· Aug 3 1m read

WARNING: Bug in IRIS Native API

Reviewing my published packages, I identified a nasty bug in IRIS Native API

  • There is a method in  %Net.DB.Iris named function ()
  • It's equivalent to  ObjectScript $$label^routine(param) 
  • It used to work fine 2 years ago, when I published my command-line-extension packages
  • Now it is broken since at least 1 year and throws <PROTECT>
  • I identified it for ObjecScript, Java, Python, Node.js
  • It is reported as WRC# 1002589
  • For all 4 cases, I also verified a workaround
    • Instead of calling an ObjectScript Function you call a Classmethod
    • It's by %Net.DB.Iris ClassMethodValue(...)
    • And you have to wrap your ObjectScript Function into some Class 
    • Might look simple, but quite some effort related to IPM versions and other

I wish you were not infected by that surprise.
 

Discussion (14)3
Log in or sign up to continue

Here explained to us that this is not a bug, but a feature: <PROTECT> *Function not allowed in IRIS Native python

Starting from 2024.1 IRIS Native disallows routine invocations. Please use class methods instead.

For reference, these changes can be identified as DP-422635 and DP-424156.

PS: and yes, additional roles and resources like %Native_*/%All etc. no eliminate the <PROTECT> error. Checked on version 2025.2.CE

It might be great to remove the related refences also
from official documentation
Py
https://docs.intersystems.com/components/csp/docbook/Python-Native/v1.0.0/irisnative.iris.html#irisnative.iris.function

Nodes.js
https://docs.intersystems.com/components/csp/docbook/NodeJS-Native/v2019.2/external-_intersystems-iris-native_.Iris.html

Java
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BJAVNAT_call#BJAVNAT_call_function

.NET
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BNETNAT_call#BNETNAT_call_function

Also Class reference for 2025.1
https://docs.intersystems.com/iris20251/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25Net.DB.Iris#Function

like this:
Calls a function (label^routine), passing zero or more arguments and returning the function's return value. Trailing arguments may be omitted, causing default values to be used for those arguments.

This method throws an exception when an error condition is encountered.

routineName

input

The name of the routine that implements the function to be called.

functionName

input

The name of the function to be invoked.

args

input...

The arguments to be passed to the method.

 

return

The value returned by the functionName function.


  • Such a misleading documentation roughly 1.5 years behind reality is not so impressive
  • It took days to find this out.  😖