Scope of methods no longer work

I just came accross very weird behaviour of Xojo. I am using Xojo 3.1 on Windows.

Inside the “app” class “Open” event I dim a local array :

strTheArray() As String

Inside module “Common” there is a sorting method called “StringSort” which takes a string array parameter. This Stringsort method can be private or protected scope, it behaves like its scope is public. I can just call it like a “global” scoped method.

So when I do inside the app “Open” event the following :

StringSort(strTheArray)

the elements inside strTheArray are sorted when the scope of Stringsort is private or protected.

Again when a method has scope “private” or “protected” inside a module, it should only be accessed inside that module (without putting the module reference).

Anyone else experienced this strange behaviour? I think this is a bug.

Thank you very much for your help in advance.

Chris

I just found out the real cause. It is a very BIG bug.

I tried out the same project unchanged in version 2.1 and it worked like expected. So this is an unacceptable bug in 3.1.

Please Xojo inc engineers how is this possible that you overlooked this bug? This is amateur behaviour, made by people who just start programming. It is simple unbelievable. Worse for me, the client was looking over my shoulder during the whole process, so he also came to the same conclusion than me when he saw the behaviour in 2.1…

It really seems that Windows developers are leaved in the cold. For Xojo engineers bugs on the Windows side does not seems important any longer. Everything is concentrated around Mac and IOS. I can not think of any other reason than that one.

Really Xojo inc engineers, you destroyed my day already.

And before anybody ask to send a bug report, I cannot because the feedback application is not working at my side.

Nice job done, I reverting back to 2.1.

I found how this bug can be reproduced.

I created a new project in Xojo 3.1. Then I created a method called “Common”. Then Inside “Common” I created a method “stupid”.

Added again an Open event in the app class and put Stupid inside it. When running it throw an error that such an object did not exist. The scope of Stupid was protected so this is correct.

Then i changed the scope to “global” (it was not changed before). and again everything worked as expected. Then I choosed “Protected” and afterwards “Private”.

Guess what, the call “Stupid” did no longer throw that error. Again the scope did not matter any longer.

If this is what we are gonna receive for the higher upgrade prices Xojo inc? You customers paying you for finding the bugs? I wish I could do the same for our customers but I do not have that luxury. Seems our quality control is higher than that of Xojo inc.

Now i am gonna take a long walk otherwise I am gonna use words which are not suitable for this public forum.

I just tried your steps in 2014r3.1, but I cannot reproduce this. Do you have a sample project you can share?

Chris - you aren’t crazy, I was able to get similar results earlier today in 2014r3.1 on OS X (including weirdness with 2 modules, where protecting the method in module2 made the module1 method protected!).

But now that I’m trying to get a sample project for Paul, I can’t duplicate it. I’ll see if I can figure out what I did differently. The only thing I can think of is that I’d had other projects open when I tried it before, and then I quit/relaunched Xojo so it was fresh.

Thank you both Paul and Bill.

I just arrived back home from a long walk again and feel relaxed again.

I will give you the exact steps to reproduce.

  1. Start Xojo 3.1

  2. In the opening screen I leave “Desktop” selected and in the right top field I put “acra”, in company name I put acra-endeavours.

  3. Then I click “OK”

  4. Insert a module and name it “SomeModule”

  5. Insert a new method and name it “MyMethod”, look to its scope but do not change it. The scope of my method is “global”.

  6. Place a MsgBox with the text “Working” inside method “MyMethod”.

  7. Add event “Open” to the “App” class.

  8. Inside event “Open” call the method “MyMethod”

  9. Choose “Run”. Because it is the first time, Avast comes up with a “Deepscreen” dialog asking me to wait. After 15 seconds I receive the message that Avast cannot find anything. A few seconds later I receive a message that the “Debug application cannot connect back to the Xojo IDE”. I see the application in the menubalk. I choose “Cancel”.

  10. I choose again “Run”. The messagebox “Working” is showing. I close that messagebox and close the application.

  11. In the navigator I select method “MyMethod” and change its scope to “Protected”.

  12. Choose “Run” again.
    13 Bingo!!! Application works without any error. Which means the call to “MyMethod” which does not reference SomeModule.MyMethod should have given an error that th object could not be found.

  13. For the record I changed the scope to “Private” and the application is still working.

  14. Whatever scope I choose, it seems “Global” after changing the scope the first time.

  15. Make a new desktop project.
    17 Make a new module “SomeModule”

  16. Create a new method inside SomeModule named “MyMethod”. Now the scope is “Protected”

  17. Add event "Open to the “App” class and place “MyMethod” inside it. When typing I can see that the Name is not recognised.

  18. Choose run

  19. Receive an error that the object does not exist

  20. Change scope to “private”

  21. Choose “run”

  22. Receive an error that the object does not exist

  23. Change the scope to “Global”

  24. Choose “Run”

  25. Everything is normal.

  26. Choose scope again to “protected”

  27. Choose “run”

  28. This time the application should raise an error. But everything is still working which is not correct.

I hope this helps finding the bug. The second time Avast did not gave any errors.

Thank you again Paul and Bill for your efforts to help me, which is very much appreciated.

I want to apologize to the Xojo inc Engineers for stressing so much. I should not have done that.

Wish you all the very best.

Friendly greetings,

Chris

Ah, that’s what I messed up before - it’s in the App.Open where this is a problem. If you try to duplicate the issue in Window1.Open I don’t see this.

Paul - saving the project makes it work as it should again. But on OS X 10.10.1 with Xojo 2014r3.1 I can duplicate his steps and get the problem.

Sounds like a problem with incremental compilation NOT using the latest signature

I also was able to reproduce it using Chris’s detailed steps.

<https://xojo.com/issue/37631>

Thank you everybody for looking into this problem. It is very much appreciated.

looks more like its incremental compilation NOT noticing the changed scope so it just uses the one compiled before

if I clear the cache in between each run it works precisely as expected