Conversion Error from USUAL (OBJECT) to STRING

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

Conversion Error from USUAL (OBJECT) to STRING

Post by boonnam »

I ran into an error which I think shouldn't have occurred. Here is a scenario:

Class ClassA
PROPERTY zPolicy AS STRING AUTO

Class ClassB
METHOD PushButton1
LOCAL cOldPolicy AS STRING
cOldPolicy := ClassA:zPolicy

If I run this code without initializing zPolicy to empty string, I get this error, "Conversion Error from USUAL (OBJECT) to STRING." I put a break point on the assignment line. While debugging I see the value for zPolicy is NULL. The value for cOldPolicy is "".

Using EXPORT:
Class ClassA
EXPORT zPolicy AS STRING

Now the value for zPolicy is also "". No error. I was expecting PROPERTY zPolicy AS STRING AUTO to also initialize zPolicy to an empty string.

We are using VO dialect. Is there a setting I need to use to prevent this error? Thanks.
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Conversion Error from USUAL (OBJECT) to STRING

Post by Chris »

Hi Boonnam,

I agree, it is not really a bug, but it would be a good idea to make STRING AUTO properties auto initialize to empty string when /vo2 is enabled (you have enabled this in your project options, this is why the EXPORT version initializes to ""). Will log this, to make /vo2 cover STRING AUTO properties as well.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply