X-Sharp / XSharpPublic

Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
Apache License 2.0
114 stars 38 forks source link

A value of type array which was initialized with NULL_ARRAY loses its type information if it is determined via an ACCESS from Self:owner. #1461

Open christianschmid200272 opened 6 months ago

christianschmid200272 commented 6 months ago

A value of type array which was initialized with NULL_ARRAY loses its type information if it is determined via an ACCESS from Self:owner. An ARRAY value null becomes an OBJECT value null. I noticed this with VO.comboBox.FillUsing which throws an error because it checks for isArray().

In VO it remains a NULL_ARRAY.

Attached is an empty standard X# MDI project, in Class XApp ClaSS MyList AS ARRAY PASCAL is defined, in AboutWindow the constructor tries to call FillUsing.

XSharp_Test_NULL_ARRAY.zip

RobertvanderHulst commented 6 months ago

You are right about the loss of the array type. However the example uses

SELF:owner:MyList

and that is not correct because SELF:Owner is the shell window and the MyList property is declared on the app.

Also the control should be created after the call to SUPER() to make sure that the window has a handle. The problem is caused by the fact that the property is accessed using a late bound call and that code does not handle typed properties of type ARRAY very well. If you remove the AS ARRAY PASCAL from the access right now, then it works.