Test and Debug
After creating the Gadget Manifest and referenced HTML file in the .gadget folder (MyFirst.gadget, in this example), you're ready to start debugging. Either copy or move the .gadget folder containing these two files into the c:\Users\YourUsername\AppData\Local\Microsoft\Windows Sidebar\Gadgets path, where "YourUsername" is the name of the active account being used to test the gadget. Opening the GadgetPicker reveals your gadget with a generic icon (Figure 3). This icon appears if there is no <icon> element in the manifest ,or in the case of the MyFirst.gadget example, the image file is missing. If the gadget fails to appear entirely, try opening the gadget.xml file in Internet Explorer. You may discover that your XML has illegal characters or is not well formed. Fix any syntax errors or illegal characters and try again. Once your XML is clean, select the gadget and it will be displayed in the Sidebar (Figure 4). It's that easy.
As you enhance the gadget's display with more attractive UI and programmed features, continue to use this GadgetPicker technique to reload any code changes. The Sidebar does not need to be restarted to refresh changes in your gadget's code, but all running instances of your gadget need to be closed before reselecting your gadget from the GadgetPicker to test any code modifications with the new instance.
While an attractive UI makes a good first impression to users, there's only so much interest in an entity with all beauty and no brains. The most popular gadgets will be those that perform a small set of functions extremely well while looking good. There are sure to be gadget programmers who go beyond these expected boundaries by creating full-blown Ajax-enabled wordprocessors and spreadsheets, but doing so is an aberration of the gadget design philosophy. Nevertheless, even with relatively simple programming logic, a script debugger always makes coding and bug hunting more efficient. A JScript debugger (such as those found in Microsoft's Script Debugger and Visual Web Developer 2005 Express Edition or Visual Studio 2005) are adequate (msdn.microsoft.com/vstudio/express/vwd). As is the case with standard web development and JavaScript debugging, be sure to uncheck the "Disable script debugging (Other)" option in Internet Explorer's Tools/Advanced tab.