Figure 6. Debug Your Gadgets.
There is no such thing as a Windows Gadget project in Visual Studio, so you can't perform debugging as you normally would. Instead, you debug a gadget much as you debug a script. To debug gadgets, you must enable script debugging in your browser of choice. I use IE7, so I'll explain how to do this in that browser. Your browser mileage (techniques) may vary. IE 7 includes two options that pertain to debugging script. If you uncheck the script options, IE lets you debug your gadget code. Once the browser is set for debugging, IE permits a debugger statement in your script code to start an instance of Visual Studio (or other application of your choice), whereupon you can step through your code.