Reply to: XMAX says Run-Time Error – How to debug this?January 13, 2009 at 11:25 pm
If you have XMetaL Developer installed it would likely be easiest to run your project using the debug feature (F5 from within Visual Studio). That will give you more feedback, let you step through each macro line by line, set break points, and do other things like “step over”, “step into”, track variable values, view the complete DOM for any open documents, and possibly other things.
If for some reason you can't do that the next best thing would be to install the Microsoft Script Debugger from the microsoft.com website and then put a “debugger” statement into one or more of the scripts inside your MCR file. That statement will trigger the Script Debugger, which will give you more feedback. A good short description of this tool exists here together with various links to Microsoft documentation and downloads: http://en.wikipedia.org/wiki/Microsoft_Script_Debugger
Failing that you are likely left to guessing which MCR file (if more than one) and which macro inside it is causing the error(s). One simplistic way to do this is to remove MCR file(s) until the error goes away (then you know which one is causing the problem), then start cutting macros out of the problem MCR file until the issue goes away (then you know which macro), then hunt it down by line number (which you already know).
We do have a feature request in our system to report which file and macro is throwing a particular error, not just the line number. There is no guarantee that such a feature will ever be implemented (partly because in most cases debugging using one of first two methods above is usually not difficult).