Undefined value in a structure

I was surprised to see this, because I was sure this should never happen in OutSystems. This is a structure with text fields having value shown as -undefined-. The values come from extension (I guess they are not assigned there), actually this particular structure was filled from another structure returned by extension, so even after copying the values they still remain "undefined". I have noticed this because comparing them to empty strings (in UTF framework assert) failed and was saying: Expected "" but obtained "". I suspect similar will happen if I compare these to empty strings directly, but haven't tried. Not sure if this is a bug or expected, but I didn't find any mention of this case on site.

Hi Kirtak,

When debugging, bear in mind that there might be Outsystems optimizations at work.

Data that is not needed by the software at some later point might not be determined/filled by Outsystems, and this would typically show as undefined in the debug window.

I don´ t know enough about your software to be sure that is the case here.


Hi Dorine. I though optimizations are shown as "unavailable in current context", not sure. But the reason why I started debugging was because I got test failures when comparing these to empty strings, with message Expected "" but obtained "" - this was not caused by debugger.


Hi Igor,

This doesn't happen in OutSystems, except if they come from an extension and the extension doesn't create the structure like it should. "undefined" here means that in C# they have a null value. To prevent this, the extension should create objects like this:

RCMyStruct myStruct = new RCMystruct(null);

so calling the constructor with null as parameter. Of course, in the code of the extension the values can be set to null again, but this should be prevented.

Thanks, this explains it. Even though I would expect such fields to have their defaults same as all other fields in OutSystems. I know that those extension structures don't come "raw", they use generated code and OutSystems framework on behind, it's surely possible to handle this.

By the way, in my example, I have checked that the field is assigned, and I don't see how it can possibly be null. But I don't have plans to analyze it further.


I'm not too versed in C# to know whether it's possible to ensure a structure is always initialized, but there may be a good reason for it not to be the case. As long as you use the proper constructor (with the "null" as parameter) it is initialized.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.