Bug - Optomized Compile Generates Error

epsharp

Member
Licensed User
Longtime User
The attached works on W98, W2K, Server 2000/2003 and Windows 7 in debug mode.

After compiling, it works on all O/S`s EXCEPT Windows 7.

This is just a code snippet; it is normally part of a security check routine to identify the Workstation and the User that is trying to execute the program. I didn't know there was a problem until I recently got a new laptop (W7), ported all development work to laptop and found out that no .exe files would run. It doesn't matter if you compile the program on the W7 machine or any other; the .exe file just bombs.

The registry fetch works, the Computer Name (Sec_Svr) is correct and the error occurs when trying to test (or msgbox or anything else) on what should be the User Name (Sec_User). Work around is to use ErrorLabel.

Regards,

Ed Sharp
 

Attachments

  • Test.sbp
    553 bytes · Views: 352

agraham

Expert
Licensed User
Longtime User
It doesn't work on Vista either. The reason is that Registry.GetString returns Null in a compiled program if the entry is missing so your StrLength throws an exception. You can check for this.
B4X:
If IsNull(Sec_User) OR StrLength(Sec_User) = 0 Then Msgbox("No User")
This works because of short-circuit evaluation on the If condition. If IsNull returns True then the StrLength function is not evaluated.
 

epsharp

Member
Licensed User
Longtime User
Error Message

To Erel,

Error message is attached.


To Agraham,

Thank you for the information.


As always, great, great support.


Regards,

Ed Sharp
 

Attachments

  • Error.jpg
    Error.jpg
    5.9 KB · Views: 331
Top