Corrupted Constant in Module

I’ve just run into the strangest bug. I had a protected constant in a module with a type of ‘number’ and a value of 4. The constant had no defined alternate values. It appeared to be ‘absolutely correct’ in the IDE, and when used, produced no analysis/compiler errors. But when running the app, if…then and select case branching statements that used that constant would never execute. I poured over the code for days, line by line in the debugger trying to find the error. I eventually switched out the module constant for the numeric value 4 in code and presto, it worked fine. I deleted the constant, saved the project, recreated the constant so that it looked ‘precisely the same’ as it did before, resaved, and now the module constant works fine.

I am hesitant to even submit a bug ticket on this. Been using Xojo/Realbasic since late 1990s and have never encountered such a thing before. I doubt i can reproduce it.

Just because the constant looks correct in the IDE, doesn’t mean it actually is.

I read the version value of the application to display it in my app
the alpha-beta-dev stage of the app is empty on one app only …
all my app use the same external items for 80% of them
one does not work.
this is a not changeable value, only from the ide, you cannot change it by code
and anyway it is still changed, on one app only.

I leaved it this way, may be one day the app stage will reappear ?

If you think there’s something fishy with a project and are going to recreate to see if that fixes, first Save As a new project to make the fix in. If it does get fixed then you still have the fishy version, but if it’s not getting fixed then just trash the new.

Yeah, will do a ‘Save As’ if it ever happens again. I was just happy to fix it. Was not trying to preserve evidence. :wink:

It could be that there was a NULL just before the value. We’ve seen that before (usually with String constants) and because they are invisible, they do very bad things if you don’t know they are there.

If you see this problem again, I’d be curious what the debugger thinks the value is. That may tell you a lot about what the problem actually is.