Re: [U2] Val on UniDynArray produces unexpected results

2010-11-15 Thread Brett Callacher
Scary indeed, we had to go through this frightful exercise.  I think it is not 
a Val that you need to search on, rather it is the multiple extracts.  If you 
are using the Visual Studio IDE then you can use pattern match searching to 
find a lot of these.



The issue was recognised by IBM quite some years ago.  IIRC, it was put down to 
a problem with Microsoft, presumably in the VB runtime.  It is documented 
somewhere.



Regards



Brett



Adrian Halid adrian.ha...@itvision.com.au wrote in message 
news:13e4ae055d203648a4121114f2458c8c9f16a05...@tefnut.perth.itvision.com.au...

Hi,



Yeah we believe the issue is referencing the same UO dynamic array on the same 
line.



We have also sent this off to Rocket and are waiting their response.



We have fixed the issue as you said by assigning the Val function to a variable 
first.



It's just a little scary to think of the millions of lines of code in our 
application and what other conditional statement may not be calculating 
correctly.



This means we are having to do a search and replace to find all instances where 
we are doing a Val in a conditional statement.



Regards



Adrian Halid

Senior Analyst/Programmer



IT Vision Australia Pty Ltd (ABN: 34 309 336 904)

PO Box 881, Canning Bridge WA 6153

Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153

P:  (08) 9315 7000  F:  (08) 9315 7088

E:  adrian.ha...@itvision.com.auW: http://www.itvision.com.au



___



NOTICE : This e-mail and any attachments are intended for the addressee(s) only 
and may

contain confidential or privileged material. Any unauthorised review, use, 
alteration,

disclosure or distribution of this e-mail (including any attachments) by an 
unintended recipient

is prohibited. If you are not the intended recipient please contact the sender 
as soon as

possible by return e-mail and then delete both messages.

___





-Original Message-

From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brett Callacher

Sent: Friday, 12 November 2010 6:16 PM

To: u2-users@listserver.u2ug.org

Subject: Re: [U2] Val on UniDynArray produces unexpected results



I think you will find that the problem here is two expressions, on the same 
line, that reference the same UO dynamic array.  Assign your Val functions to 
variables first and then use these variables in your case statement.







HTH







Brett







Adrian Halid adrian.ha...@itvision.com.au wrote in message 
news:13e4ae055d203648a4121114f2458c8c9f16a05...@tefnut.perth.itvision.com.au...



 Hi All,







 We have come across a very strange bug between UniDynArray and VB6.







 In our applications we were getting two different results on an if statement 
 between the IDE and the compiled (into Native) exe.







 In the IDE case the statement was returning True which is correct.



 In the compiled native exe the exact same statement was returning false which 
 is wrong as the statement should evaluate to true.



 If we compiled the exe into p-code then the statement evaluates to True as it 
 should.







 The conditional statement seems to have to be in this exact structure (kind 
 of like a perfect storm of conditions).







 ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))







 It must compare the same UniDynArray in each part of the if statement and 
 perform a Val on the second UniDynArray.







 The issue can be demonstrated by the sample code below.



 We have two Booleans (b1 and b2) that should always evaluate to true.



 In the VB6 IDE b1 is true and b2 is true as expected.



 In the Compile Native exe b1 actually evaluates to false. (This is wrong b1 
 and b2 should always be True).







 ---



 Dim var1 As UniDynArray



 Dim b1 As Boolean



 Dim b2 As Boolean







 Set var1 = New UniDynArray







 var1.Field(1).StringValue = 1



 var1.Field(2).StringValue = 







 ' b1 and b2 should always be True



 ' When compiled into Native Code b1 is false and b2 is true. Why?







 b1 = ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))







 b2 = ((False And Val(var1.Field(2).StringValue)  0) Or 
 (var1.Field(1).StringValue  ))







 MsgBox b1=  b1   and b2=  b2







 ---







 I know we can fix the problem quickly by swapping round the conditional 
 blocks or create new variables to hold the string values and then compare 
 them.







 My concern is that in our very large application what conditional statements 
 could be failing in the executable we send out

Re: [U2] Val on UniDynArray produces unexpected results

2010-11-14 Thread Adrian Halid
Hi,

Yeah we believe the issue is referencing the same UO dynamic array on the same 
line.

We have also sent this off to Rocket and are waiting their response.

We have fixed the issue as you said by assigning the Val function to a variable 
first.

It's just a little scary to think of the millions of lines of code in our 
application and what other conditional statement may not be calculating 
correctly.

This means we are having to do a search and replace to find all instances where 
we are doing a Val in a conditional statement.

Regards

Adrian Halid
Senior Analyst/Programmer
 
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P:  (08) 9315 7000  F:  (08) 9315 7088
E:  adrian.ha...@itvision.com.au    W: http://www.itvision.com.au
    
___  
  
NOTICE : This e-mail and any attachments are intended for the addressee(s) only 
and may
contain confidential or privileged material. Any unauthorised review, use, 
alteration,
disclosure or distribution of this e-mail (including any attachments) by an 
unintended recipient
is prohibited. If you are not the intended recipient please contact the sender 
as soon as
possible by return e-mail and then delete both messages.
___


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brett Callacher
Sent: Friday, 12 November 2010 6:16 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Val on UniDynArray produces unexpected results

I think you will find that the problem here is two expressions, on the same 
line, that reference the same UO dynamic array.  Assign your Val functions to 
variables first and then use these variables in your case statement.



HTH



Brett



Adrian Halid adrian.ha...@itvision.com.au wrote in message 
news:13e4ae055d203648a4121114f2458c8c9f16a05...@tefnut.perth.itvision.com.au...

 Hi All,



 We have come across a very strange bug between UniDynArray and VB6.



 In our applications we were getting two different results on an if statement 
 between the IDE and the compiled (into Native) exe.



 In the IDE case the statement was returning True which is correct.

 In the compiled native exe the exact same statement was returning false which 
 is wrong as the statement should evaluate to true.

 If we compiled the exe into p-code then the statement evaluates to True as it 
 should.



 The conditional statement seems to have to be in this exact structure (kind 
 of like a perfect storm of conditions).



 ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))



 It must compare the same UniDynArray in each part of the if statement and 
 perform a Val on the second UniDynArray.



 The issue can be demonstrated by the sample code below.

 We have two Booleans (b1 and b2) that should always evaluate to true.

 In the VB6 IDE b1 is true and b2 is true as expected.

 In the Compile Native exe b1 actually evaluates to false. (This is wrong b1 
 and b2 should always be True).



 ---

 Dim var1 As UniDynArray

 Dim b1 As Boolean

 Dim b2 As Boolean



 Set var1 = New UniDynArray



 var1.Field(1).StringValue = 1

 var1.Field(2).StringValue = 



 ' b1 and b2 should always be True

 ' When compiled into Native Code b1 is false and b2 is true. Why?



 b1 = ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))



 b2 = ((False And Val(var1.Field(2).StringValue)  0) Or 
 (var1.Field(1).StringValue  ))



 MsgBox b1=  b1   and b2=  b2



 ---



 I know we can fix the problem quickly by swapping round the conditional 
 blocks or create new variables to hold the string values and then compare 
 them.



 My concern is that in our very large application what conditional statements 
 could be failing in the executable we send out.







 Regards



 Adrian Halid

 Senior Analyst/Programmer



 IT Vision Australia Pty Ltd (ABN: 34 309 336 904)

 PO Box 881, Canning Bridge WA 6153

 Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153

 P:  (08) 9315 7000  F:  (08) 9315 7088

 E:  adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au
 W: http://www.itvision.com.auhttp://www.itvision.com.au/







 ___



 NOTICE : This e-mail and any attachments are intended for the addressee(s) 
 only and may

 contain confidential or privileged material. Any unauthorised review, use, 
 alteration,

 disclosure or distribution of this e-mail (including any

Re: [U2] Val on UniDynArray produces unexpected results

2010-11-12 Thread Brian Leach
var1.Field(1).StringValue  

Do you mean that? Or do you mean var1.Field(1).StringValue   ?

Differences between the P-Code and fully compiled code have been a 'feature'
of VB for a long time - the compiled code is generally more accurate/less
forgiving and - whilst not relevant here - if you have any sort of
multithreading in your code, that can operate differently. 

If you are concerned, can you send out the P-Code executable? On today's
processors, the performance difference is unlikely to hurt.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Adrian Halid
Sent: 12 November 2010 02:18
To: u2-users@listserver.u2ug.org
Subject: [U2] Val on UniDynArray produces unexpected results

Hi All,

We have come across a very strange bug between UniDynArray and VB6.

In our applications we were getting two different results on an if statement
between the IDE and the compiled (into Native) exe.

In the IDE case the statement was returning True which is correct.
In the compiled native exe the exact same statement was returning false
which is wrong as the statement should evaluate to true.
If we compiled the exe into p-code then the statement evaluates to True as
it should.

The conditional statement seems to have to be in this exact structure (kind
of like a perfect storm of conditions).

((var1.Field(1).StringValue  ) Or (False And
Val(var1.Field(2).StringValue)  0))

It must compare the same UniDynArray in each part of the if statement and
perform a Val on the second UniDynArray.

The issue can be demonstrated by the sample code below.
We have two Booleans (b1 and b2) that should always evaluate to true.
In the VB6 IDE b1 is true and b2 is true as expected.
In the Compile Native exe b1 actually evaluates to false. (This is wrong b1
and b2 should always be True).


---
Dim var1 As UniDynArray
Dim b1 As Boolean
Dim b2 As Boolean

Set var1 = New UniDynArray

var1.Field(1).StringValue = 1
var1.Field(2).StringValue = 

' b1 and b2 should always be True
' When compiled into Native Code b1 is false and b2 is true. Why?

b1 = ((var1.Field(1).StringValue  ) Or (False And
Val(var1.Field(2).StringValue)  0))

b2 = ((False And Val(var1.Field(2).StringValue)  0) Or
(var1.Field(1).StringValue  ))

MsgBox b1=  b1   and b2=  b2


---

I know we can fix the problem quickly by swapping round the conditional
blocks or create new variables to hold the string values and then compare
them.

My concern is that in our very large application what conditional statements
could be failing in the executable we send out.



Regards

Adrian Halid
Senior Analyst/Programmer

IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P:  (08) 9315 7000  F:  (08) 9315 7088
E:  adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au
W: http://www.itvision.com.auhttp://www.itvision.com.au/



___

NOTICE : This e-mail and any attachments are intended for the addressee(s)
only and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any attachments) by an
unintended recipient
is prohibited. If you are not the intended recipient please contact the
sender as soon as
possible by return e-mail and then delete both messages.
___


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Val on UniDynArray produces unexpected results

2010-11-12 Thread Symeon Breen
What are you expecting when doing a  operator on a string ?   I am not sure
what the result should be in that case ??

 

From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Adrian Halid
Sent: 12 November 2010 02:18
To: u2-users@listserver.u2ug.org
Subject: [U2] Val on UniDynArray produces unexpected results

 

Hi All,

We have come across a very strange bug between UniDynArray and VB6.

In our applications we were getting two different results on an if statement
between the IDE and the compiled (into Native) exe.

In the IDE case the statement was returning True which is correct.
In the compiled native exe the exact same statement was returning false
which is wrong as the statement should evaluate to true.
If we compiled the exe into p-code then the statement evaluates to True as
it should.

The conditional statement seems to have to be in this exact structure (kind
of like a perfect storm of conditions).

((var1.Field(1).StringValue  ) Or (False And
Val(var1.Field(2).StringValue)  0))

It must compare the same UniDynArray in each part of the if statement and
perform a Val on the second UniDynArray.

The issue can be demonstrated by the sample code below.
We have two Booleans (b1 and b2) that should always evaluate to true.
In the VB6 IDE b1 is true and b2 is true as expected.
In the Compile Native exe b1 actually evaluates to false. (This is wrong b1
and b2 should always be True).


---
Dim var1 As UniDynArray
Dim b1 As Boolean
Dim b2 As Boolean

Set var1 = New UniDynArray

var1.Field(1).StringValue = 1
var1.Field(2).StringValue = 

' b1 and b2 should always be True
' When compiled into Native Code b1 is false and b2 is true. Why?

b1 = ((var1.Field(1).StringValue  ) Or (False And
Val(var1.Field(2).StringValue)  0))

b2 = ((False And Val(var1.Field(2).StringValue)  0) Or
(var1.Field(1).StringValue  ))

MsgBox b1=  b1   and b2=  b2


---

I know we can fix the problem quickly by swapping round the conditional
blocks or create new variables to hold the string values and then compare
them.

My concern is that in our very large application what conditional statements
could be failing in the executable we send out.



Regards

Adrian Halid
Senior Analyst/Programmer

IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P:  (08) 9315 7000  F:  (08) 9315 7088
E:  adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au
W: http://www.itvision.com.auhttp://www.itvision.com.au/



___

NOTICE : This e-mail and any attachments are intended for the addressee(s)
only and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any attachments) by an
unintended recipient
is prohibited. If you are not the intended recipient please contact the
sender as soon as
possible by return e-mail and then delete both messages.
___


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users 

  _  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1153 / Virus Database: 424/3250 - Release Date: 11/11/10

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Val on UniDynArray produces unexpected results

2010-11-12 Thread Brett Callacher


Adrian Halid adrian.ha...@itvision.com.au wrote in message 
news:13e4ae055d203648a4121114f2458c8c9f16a05...@tefnut.perth.itvision.com.au...
 Hi All,

 We have come across a very strange bug between UniDynArray and VB6.

 In our applications we were getting two different results on an if statement 
 between the IDE and the compiled (into Native) exe.

 In the IDE case the statement was returning True which is correct.
 In the compiled native exe the exact same statement was returning false which 
 is wrong as the statement should evaluate to true.
 If we compiled the exe into p-code then the statement evaluates to True as it 
 should.

 The conditional statement seems to have to be in this exact structure (kind 
 of like a perfect storm of conditions).

 ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))

 It must compare the same UniDynArray in each part of the if statement and 
 perform a Val on the second UniDynArray.

 The issue can be demonstrated by the sample code below.
 We have two Booleans (b1 and b2) that should always evaluate to true.
 In the VB6 IDE b1 is true and b2 is true as expected.
 In the Compile Native exe b1 actually evaluates to false. (This is wrong b1 
 and b2 should always be True).

 ---
 Dim var1 As UniDynArray
 Dim b1 As Boolean
 Dim b2 As Boolean

 Set var1 = New UniDynArray

 var1.Field(1).StringValue = 1
 var1.Field(2).StringValue = 

 ' b1 and b2 should always be True
 ' When compiled into Native Code b1 is false and b2 is true. Why?

 b1 = ((var1.Field(1).StringValue  ) Or (False And 
 Val(var1.Field(2).StringValue)  0))

 b2 = ((False And Val(var1.Field(2).StringValue)  0) Or 
 (var1.Field(1).StringValue  ))

 MsgBox b1=  b1   and b2=  b2

 ---

 I know we can fix the problem quickly by swapping round the conditional 
 blocks or create new variables to hold the string values and then compare 
 them.

 My concern is that in our very large application what conditional statements 
 could be failing in the executable we send out.



 Regards

 Adrian Halid
 Senior Analyst/Programmer

 IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
 PO Box 881, Canning Bridge WA 6153
 Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
 P:  (08) 9315 7000  F:  (08) 9315 7088
 E:  adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au
 W: http://www.itvision.com.auhttp://www.itvision.com.au/



 ___

 NOTICE : This e-mail and any attachments are intended for the addressee(s) 
 only and may
 contain confidential or privileged material. Any unauthorised review, use, 
 alteration,
 disclosure or distribution of this e-mail (including any attachments) by an 
 unintended recipient
 is prohibited. If you are not the intended recipient please contact the 
 sender as soon as
 possible by return e-mail and then delete both messages.
 ___


 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users

This message contains information that may be privileged or confidential and is 
the property of GPM Development Ltd. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient ,you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.

This e-mail was sent to you by GPM Development Ltd.  We are incorporated under 
the laws of England and Wales (company no. 2292156 and VAT registration no. 523 
5622 63).  Our registered office is 6th Floor, AMP House, Croydon, Surrey CR0 
2LX.
 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Val on UniDynArray produces unexpected results

2010-11-12 Thread Brett Callacher
Testing a string   is a valid way to test for a non-null variable IMO.  If 
you think about it a string can never be  .  Am not aware of a language, 
p-code or otherwise, where that is not the case.



Brett



Brian Leach br...@brianleach.co.uk wrote in message 
news:004b01cb8248$26598bd0$730ca3...@co.uk...

 var1.Field(1).StringValue  



 Do you mean that? Or do you mean var1.Field(1).StringValue   ?



 Differences between the P-Code and fully compiled code have been a 'feature'

 of VB for a long time - the compiled code is generally more accurate/less

 forgiving and - whilst not relevant here - if you have any sort of

 multithreading in your code, that can operate differently.



 If you are concerned, can you send out the P-Code executable? On today's

 processors, the performance difference is unlikely to hurt.



 Brian



 -Original Message-

 From: u2-users-boun...@listserver.u2ug.org

 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Adrian Halid

 Sent: 12 November 2010 02:18

 To: u2-users@listserver.u2ug.org

 Subject: [U2] Val on UniDynArray produces unexpected results



 Hi All,



 We have come across a very strange bug between UniDynArray and VB6.



 In our applications we were getting two different results on an if statement

 between the IDE and the compiled (into Native) exe.



 In the IDE case the statement was returning True which is correct.

 In the compiled native exe the exact same statement was returning false

 which is wrong as the statement should evaluate to true.

 If we compiled the exe into p-code then the statement evaluates to True as

 it should.



 The conditional statement seems to have to be in this exact structure (kind

 of like a perfect storm of conditions).



 ((var1.Field(1).StringValue  ) Or (False And

 Val(var1.Field(2).StringValue)  0))



 It must compare the same UniDynArray in each part of the if statement and

 perform a Val on the second UniDynArray.



 The issue can be demonstrated by the sample code below.

 We have two Booleans (b1 and b2) that should always evaluate to true.

 In the VB6 IDE b1 is true and b2 is true as expected.

 In the Compile Native exe b1 actually evaluates to false. (This is wrong b1

 and b2 should always be True).



 

 ---

 Dim var1 As UniDynArray

 Dim b1 As Boolean

 Dim b2 As Boolean



 Set var1 = New UniDynArray



 var1.Field(1).StringValue = 1

 var1.Field(2).StringValue = 



 ' b1 and b2 should always be True

 ' When compiled into Native Code b1 is false and b2 is true. Why?



 b1 = ((var1.Field(1).StringValue  ) Or (False And

 Val(var1.Field(2).StringValue)  0))



 b2 = ((False And Val(var1.Field(2).StringValue)  0) Or

 (var1.Field(1).StringValue  ))



 MsgBox b1=  b1   and b2=  b2



 

 ---



 I know we can fix the problem quickly by swapping round the conditional

 blocks or create new variables to hold the string values and then compare

 them.



 My concern is that in our very large application what conditional statements

 could be failing in the executable we send out.







 Regards



 Adrian Halid

 Senior Analyst/Programmer



 IT Vision Australia Pty Ltd (ABN: 34 309 336 904)

 PO Box 881, Canning Bridge WA 6153

 Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153

 P:  (08) 9315 7000  F:  (08) 9315 7088

 E:  adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au

 W: http://www.itvision.com.auhttp://www.itvision.com.au/







 ___



 NOTICE : This e-mail and any attachments are intended for the addressee(s)

 only and may

 contain confidential or privileged material. Any unauthorised review, use,

 alteration,

 disclosure or distribution of this e-mail (including any attachments) by an

 unintended recipient

 is prohibited. If you are not the intended recipient please contact the

 sender as soon as

 possible by return e-mail and then delete both messages.

 ___





 ___

 U2-Users mailing list

 U2-Users@listserver.u2ug.org

 http://listserver.u2ug.org/mailman/listinfo/u2-users





 ___

 U2-Users mailing list

 U2-Users@listserver.u2ug.org

 http://listserver.u2ug.org/mailman/listinfo/u2-users





This message contains information that may be privileged or confidential and is 
the property of GPM Development Ltd. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient ,you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please