5

Clearly I've been spoiled with Chrome and its developers tools but I'm struggling to formulate a painless debugging strategy while developing Office 2013 apps using the new JavaScript API for Office.

Visual Studio 2012 helps by providing the script debugging and the immediate window but I'm finding the following to be a challenge and would appreciate pointers/guidance:

  1. Reload the Office app (right-click "reload") breaks Visual Studio script debugging and so it's often easier to end debugging and start again. Why does it break? Can I stop it breaking?

  2. Is there something comparable to Chrome's "inspect element" and all the related DOM exploring functionality? I'm using client-side templating (KnockoutJS) and am resorting to using the immediate window to try to introspect the DOM.

  3. My code makes AJAX calls but, short of inline debugging statements, I've not found a way to track calls like with Chrome's Network tab.

Three things that I've learned/discovered that may benefit others are:

  1. Don't "stop debugging" while the debugger's paused (break) as this tends to hang Visual Studio and the only way to get back is to kill it and restart which is tedious. If you continue through your code until it (hopefully) terminates, then you can stop the debugger without problem.

  2. Microsoft's sample code adds debugging information to an element on the HTML page of the app. I've found this sub-optimal and simply create a 'debugging' table in my apps that adds a row every time I wish to report something. This has the additional advantage of being persisted across debugging sessions. I published gists both for a table wrapper and for an error handler that extends the table wrapper.

  3. "Quick Watch" in Visual Studio 2012 is useful for evaluating jQuery expressions and analyzing JSON results.

6
  • 2
    Is there any way you can mock the data, and dev inside chrome? Commented Sep 29, 2012 at 0:03
  • disclaimer: never used the office API (it may show) Commented Sep 29, 2012 at 0:05
  • 1
    You know, I was wondering this today when I was out walking my dog. I think this is probably exactly what I should do. If I do a decent job, the mocked library should be useful to others too. Thanks! Commented Sep 30, 2012 at 0:19
  • I guess I'll write that up as an answer? :D Commented Sep 30, 2012 at 0:49
  • 1
    Weekend project: github.com/brabantcourt/lopeway.mock-office Commented Oct 2, 2012 at 22:44

1 Answer 1

1

If at all possible and practical, try and mock the data, and develop inside a different environment. At the very least, it'll get you a lot further into the project so you can debug simple stuff easier and faster, before moving back to your traditional environment for other stuff.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.