stack-traceinternet-explorer-11console.logchakra

IE11 Console: Increase stack trace depth


In Chrome, you can increase the stack trace depth by setting a flag at runtime (using --js-flags="--stack-trace-limit <value>"), or through the console (using Error.stackTraceLimit), explained here: https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi

This is also possible in Firebug, from what I understand, although I'm not as familiar with the intricacies of that tool.

Is there any provision for this in IE11? I'm dealing with an IE-specific issue, and the stack trace doesn't shed any light beyond my library's code (AngularJS). Increasing the stack trace depth would likely help me here.

Thanks!


Solution

  • It appears that no documented Command Line Option exists that would offer this control. You can, however, increase the stack trace in Internet Explorer much like you would other popular browsers:

    Error.stackTraceLimit = 20; // The default is 10
    

    Internet Explorer has supported this property on the Error constructor since version 10. It will not work in versions prior to that. In 2012 the IEBlog demonstrated some sample use of this property, as well as use of Error.stack.

    There doesn't appear to be any way to persist this setting for all page requests. The only option I could suggest here would be to setup a proxy that adds this to all server responses. Naturally I would encourage Fiddler for this.

    Like other browsers, Internet Explorer 11 supports console.trace. So you need not wait for an error to get your stack trace. You can invoke it arbitrarily at any time.

    One last feature to look at would be profiling. You can control profiling sessions via console.profile and console.profileEnd (both of which are fairly standard) if you wish to capture only a specific slice of your applications lifecycle.