Question Stefan Rieger · Feb 23, 2020

Cannot invoke %SYSTEM.OBJ.Load() by IRIS.ClassMethodStatusCode

trying import ClassDefinition File via <IRISClient.Ado.IRIS> result with error: 

InterSystems.Data.IRISClient.IRISException (0x80004005): Exception thrown on server (code = 1242) : <REMOTE EXECUTE INVALID WRITE>Load+19^%apiOBJ

running: IRIS for Windows (x86-64) 2020.1 (Build 197U) Thu Jan 23 2020 09:56:09 EST

am i missing something?

        public void LoadClass()
        {
            
            // import/ update <Installer.Package> to %SYS NameSpace
            using (var c = new IRISConnection("SERVER=127.0.0.1;PORT=51773;NAMESPACE=%SYS;USER ID=_system;PASSWORD=SYS;"))
            {
                c.Open();
                var iris = IRIS.CreateIRIS(c);
                var fp = @"c:\tmp\DbNameSpace.cls";
                var qspec = "";
                var errs = "";
                var loadeditems = "";
                var parameter = new object[]
                {
                    fp, qspec,errs, loadeditems
                };
                try
                {
                    iris.ClassMethodStatusCode("%SYSTEM.OBJ", "Load", parameter);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
                iris.Close();
            }

        }

Comments

Eduard Lebedyuk · Feb 23, 2020

Load method writes to the current device which is a big no in the Native API ecosystem. Add flags to suppress all output:

var qspec = "/displaylog=0 /displayerror=0";  
0
Stefan Rieger  Feb 24, 2020 to Eduard Lebedyuk

thanks; that did the job...

... and i guess you're right with what you say - for my perspective this behaviour is somehow strange; Shouldn't then InterSystems add a "dummy device" on calling methods to avoid these kind of exceptions? 

Never before i had a problem like that calling e.g. LoadMethod and for my sight it's a bit irritating that InterSystems expect me to know if a method i'll call will write to a "not allowed device" and to investigate how to trick that away 

0
Jon Willeke  Feb 27, 2020 to Stefan Rieger

I found this limitation surprising too. My understanding is that it has to do with the current device being the Native API's TCP connection to the server.

I can never remember how to mention someone on this forum, but I'll try to make @Raj Singh aware of your feedback.

0
Raj Singh  Feb 28, 2020 to Alexander Koblov

Thanks @akoblov. We'll look into it.

0