I’m trying to create a sidebar gadget without the use of Visual Studio. I’ve looked around for ways to debug them, but everything says that the Visual Studio JIT debugger is the only way to do it.
Has anyone been able to debug sidebar gadgets without Visual Studio?
For years, I didn’t use Visual Studio to work on Gadgets. There are a couple of ways you can debug gadgets without it, just not as extensively. For instance, you can’t use the
debugger;command without a proper debugger attached to the process. What you can do is use a program like DebugView to catch messages output by theSystem.Debug.outputString()method:This allows you to output variable dumps and other useful tidbits of information at certain stages of your code, so you can track it however you like.
As an alternative, you can roll your own debugging/script halting messages using
window.prompt().alert()was disabled for gadgets andconfirm()is overridden to always return true, but they must have overlookedprompt().The
JSON.stringify()method really helps out if you want to examine the state of an object during code execution.Instead of
window.prompt, you can also use the VBScriptMsgBox()function:Finally, you can catch all errors with your script using the
window.onerrorevent handler.The
window.onerrorevent even lets you output the line number and file (only accurate with IE8) in which the error occurred.Good luck debugging, and remember not to leave in any window.prompts or MsgBoxes when you publish your gadget!