from xDev March/April 2016, www.xdevmag.com
Youre stuck. Your code should work, but it isnt. Or it does something unexpected and weird. Now what?
1. Use the debugger to follow code execution
Im always amazed by how many people dont 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 debuggerso 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 theres a system upgrade. But sometimes Xojo gets confused and things dont work or dont behave as youd 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). Its 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 cant recreate the problem in a sample project, then the bug wasnt where you thought it was anyway, and youll save a lot of time not following the wrong lead.
Basic rule: if you cant be bothered to make a sample project, then you dont 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 dont wait for others to remember the bug report or for them to check feedbackdo it yourself!
5. Implement a tracking system
With event-driven programming, it is sometimes difficult to figure out what is called when and wheredont simply assume that events happen in a certain order. Thomas Tempelmans 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. Dont 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 cant 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 havent done the basic trouble-shooting. I know I have been guilty of it myself - but Ill try to do better… (Oh look, a flying pig!)