Solving problems

from xDev March/April 2016, www.xdevmag.com

Solving problems

You’re stuck. Your code should work, but it isn’t. Or it does something unexpected and weird. Now what?

1. Use the debugger to follow code execution
I’m always amazed by how many people don’t follow their code in the debugger when they look for bugs. If you follow along in the debugger, then you can see which variable might not contain what you think it should contain. For example, integer overflow errors are easy to spot in the debugger—so use it! And keep in mind conditional breakpoints as mentioned in xDev 12.5 Sep/Oct 2014 Tip 3.

2. Restart Xojo and clear the cache
I have Xojo running all the time and my computer only gets restarted when there’s a system upgrade. But sometimes Xojo gets confused and things don’t work or don’t behave as you’d expect. A restart of Xojo often fixes that, but sometimes I need to restart the computer (usually when Xojo has been running for weeks or months). It’s worth repeating the tip from xDev 12.3 May/Jun 2014 Tip 6 by Christian Schmitz from MonkeyBread Software again: “For me the Cache folder has symbolic links named ‘Xojo’ and Real Studio’ which point to /tmp, so every time the Mac restarts, I get a cleared cache.” So no need to clear the cache by hand anymore.

3. Make a sample project
If you see the problem in a small sample project, then you can not only exclude some unexpected side effects from the rest of your code, it will also make finding and fixing the problem much easier.
If you can’t recreate the problem in a sample project, then the bug wasn’t where you thought it was anyway, and you’ll save a lot of time not following the wrong lead.
Basic rule: if you can’t be bothered to make a sample project, then you don’t need help that urgently, if at all.

4. Check feedback
Maybe someone else has reported the same problem and maybe it is a known bug. If you are lucky, there might even be a workaround. So don’t wait for others to remember the bug report or for them to check feedback—do it yourself!

5. Implement a tracking system
With event-driven programming, it is sometimes difficult to figure out what is called when and where—don’t simply assume that events happen in a certain order. Thomas Tempelman’s free MethodProfiler (see xDev 13.6 Nov/Dec 2015 Tip 5) might be able to help.

6. Then and only then ask on the forum
Describe your problem and provide a link to the sample project. Don’t expect who-knows-how- many people to create sample projects based on your more or less accurate description just because you are too lazy and can’t be bothered. Henry David Thoreau (xDev 12.4 Jul/Aug 2014 Intro) would be very cross with you about wasting so much life time.

All these recommendations should be obvious, but too often I see people asking for help on the forums that haven’t done the basic trouble-shooting. I know I have been guilty of it myself —- but I’ll try to do better… (Oh look, a flying pig!)

You can’t expect new users to be able to use the Debugger the “right” way, clear the Xojo Cache, how to implement an Error/Issue Tracking System and more.

I still say: If you’re stuck, go to the Forum and ask for help. Always.

If one gets bored/anoyed by “newbie” questions which have been answered already 1000 times on the Forum, he/she can always ignore such conversations. :wink:

BTW: For me sounds “i am stuck” like “I have already tried every solution, workaround i know of and tried to track down the issue as good as i could, but i am still not able to solve it”. :wink:

Will be nice if we have a channel with answered questions so will be more easy for users to go through there and check it.
The search in forum is no easy.

[quote=259080:@Loannis Kolliageorgas]Will be nice if we have a channel with answered questions so will be more easy for users to go through there and check it.
The search in forum is no easy.[/quote]

No, please not. Noone would do this. Would be no fun. :smiley:

The search is not perfect, but you can find your answers often enough with it, in my opinion.

Don’t search the forum, just use Google.

That’s why I’m posting this. So they know what they should do first.

And it’s not just newbies this applies to …

Where are the caches ?

In OS X, here:

Library/Caches/Xojo/

To access the Library folder, press with the Mouse the Go (Go To ?) Menu with the Option Key down, then release the mouse when the Library MenuItem is selected. Then seach for a Caches folder, then at the bottom, a Xojo folder.

For Windows ?

[quote=259069:@Markus Winter]…
4. Check feedback
Maybe someone else has reported the same problem and maybe it is a known bug. If you are lucky, there might even be a workaround. So don’t wait for others to remember the bug report or for them to check feedback—do it yourself!
…[/quote]

in Linux not possible unfortunately …

Windows 10:

  • Windows key + R shortcut
  • Type %temp%

All user caches are displayed. Send everything to the trash or only Xojo folders.
But I 'm not sure that all Xojo caches are here .

users\\appdata\roaming\xojo

Thanks Markus, a couple of items on that list that I was not aware of.