<p dir="auto">Debugging a Node program that uses <a href="https://nodejs.org/api/util.html#util_util_inspect_object_options" rel="nofollow">util.inspect</a> hangs the underlying node process.</p>
<p dir="auto">I stumbled across this while working on an app that depends on the Azure Storage SDK for Node (it uses util.inspect). I don't have a workaround for debugging right now, but the app works fine when running directly from the command line.</p>
<p dir="auto">I've created a repro of the problem here:<br>
<a href="https://gist.github.com/benquarmby/36f6c00947ad04509212">https://gist.github.com/benquarmby/36f6c00947ad04509212</a></p>
<p dir="auto">Steps:</p>
<ul dir="auto">
<li>Create a script that invokes util.inspect on an object</li>
<li>Place a breakpoint in the script <em>after</em> the call util.inspect</li>
<li>Start debugging</li>
<li>Observe that the breakpoint is not hit</li>
</ul>
<p dir="auto">Environment:</p>
<ul dir="auto">
<li>VSCode 0.10.6</li>
<li>Windows 10 x64</li>
<li>Node 5.5 x64</li>
</ul>
<p dir="auto">launch this snippet <code class="notranslate">test.js</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var obj = {};
console.log(obj);
console.log(obj);"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">obj</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">obj</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">with <code class="notranslate">node --debug-brk test.js</code> and attach a debugger, e.g. node-inspector or VSCode.</p>
<p dir="auto">The first <em>step</em> command works fine, the second <em>step</em> crashes node on all platforms.</p>