Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace from throw in debug console should hide everything below "eval" #1259

Closed
jakebailey opened this issue May 6, 2022 · 18 comments · Fixed by #1263 or #1576
Closed

Stack trace from throw in debug console should hide everything below "eval" #1259

jakebailey opened this issue May 6, 2022 · 18 comments · Fixed by #1263 or #1576
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@jakebailey
Copy link
Member

Is your feature request related to a problem? Please describe.

When I do something in the debug console that throws, I get a huge massive error message, which I have to scroll all the way past to figure out what I did wrong (99% of the time, I've hit enter instead of tab when trying to auto-complete; that's a different problem).

Describe the feature you'd like

The stack trace that is shown for errors that are thrown should drop anything past the eval, since that's where the executed code is actually rooted from. Nothing below eval in the trace string is really controllable; that's just where you are in the debug session.

Anything eval and "above" is what should be kept, so you can see errors thrown from functions called from the console, like:

image

@jakebailey jakebailey added the feature-request Request for new features or functionality label May 6, 2022
@jakebailey
Copy link
Member Author

Just so you can see how huge I'm talking about, this is what I get on a regular basis debugging TS...

Details
Uncaught TypeError TypeError: Cannot read property 'pos' of undefined
    at makeAsExpression (e:\work\TypeScript\src\compiler\parser.ts:4884:77)
    at eval (<eval>/VM46952632:1:1)
    at parseSourceFileWorker (e:\work\TypeScript\src\compiler\parser.ts:1118:32)
    at parseSourceFile (e:\work\TypeScript\src\compiler\parser.ts:935:28)
    at createSourceFile (e:\work\TypeScript\src\compiler\parser.ts:720:29)
    at <anonymous> (e:\work\TypeScript\src\harness\fakesHosts.ts:353:31)
    at findSourceFileWorker (e:\work\TypeScript\src\compiler\program.ts:2919:31)
    at findSourceFile (e:\work\TypeScript\src\compiler\program.ts:2812:28)
    at <anonymous> (e:\work\TypeScript\src\compiler\program.ts:2764:29)
    at getSourceFileFromReferenceWorker (e:\work\TypeScript\src\compiler\program.ts:2727:36)
    at processSourceFile (e:\work\TypeScript\src\compiler\program.ts:2762:13)
    at processRootFile (e:\work\TypeScript\src\compiler\program.ts:2541:13)
    at <anonymous> (e:\work\TypeScript\src\compiler\program.ts:1199:49)
    at forEach (e:\work\TypeScript\src\compiler\core.ts:38:32)
    at createProgram (e:\work\TypeScript\src\compiler\program.ts:1199:13)
    at compileFiles (e:\work\TypeScript\src\harness\compilerImpl.ts:261:54)
    at compileFiles (e:\work\TypeScript\src\harness\harnessIO.ts:434:37)
    at CompilerTest (e:\work\TypeScript\src\testRunner\compilerRunner.ts:237:36)
    at <anonymous> (e:\work\TypeScript\src\testRunner\compilerRunner.ts:86:32)
    at callFn (e:\work\TypeScript\node_modules\mocha\lib\runnable.js:366:21)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runnable.js:354:5)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:498:10)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:559:5)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:558:10)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:903:8)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)
    --- Immediate ---
    at init (internal/inspector_async_hook.js:25:19)
    at emitInitNative (internal/async_hooks.js:199:43)
    at emitInitScript (internal/async_hooks.js:467:3)
    at initAsyncResource (internal/timers.js:157:5)
    at Immediate (timers.js:246:5)
    at setImmediate (timers.js:300:10)
    at next (e:\work\TypeScript\node_modules\mocha\lib\runner.js:880:14)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:849:12)
    at <anonymous> (e:\work\TypeScript\node_modules\mocha\lib\runner.js:881:14)
    at processImmediate (internal/timers.js:461:21)
    at callbackTrampoline (internal/async_hooks.js:131:14)

@jakebailey
Copy link
Member Author

I also swear this used to not be the case at all; the huge stack traces are something that I only started seeing recently, so maybe this is a bug and this is supposed to be working as I describe.

@connor4312
Copy link
Member

connor4312 commented May 6, 2022

Fair suggestion, should not be terribly hard, we already have a stacktrace parser. Code pointer:

if (response.exceptionDetails) {
const formattedException = await new ExceptionMessage(response.exceptionDetails).toDap(this);
throw new ProtocolError(errors.replError(formattedException.output));
} else {

@connor4312 connor4312 added the help welcome Issues identified as good community contribution opportunities label May 6, 2022
@jakebailey
Copy link
Member Author

Interesting, thanks for pointing that out. I imagine we'd need to know exactly which eval was triggered by the debug console, otherwise it could be cut off at the wrong one.

@connor4312
Copy link
Member

connor4312 commented May 6, 2022

The code path I linked deals with the response from a REPL evaluation. However, yes, we need to know what frame in the stack was the expression. One way to do this would be to name the sources ahead of time by appending a \n//# sourceURL=... comment at the end prior to evaluation. We do that for internal scripts to avoid cluttering the Loaded Scripts view.

@jakebailey
Copy link
Member Author

I have it working; will send something on Monday.

image

@connor4312 connor4312 added this to the June 2022 milestone Jun 20, 2022
@connor4312 connor4312 added the verification-needed Verification of issue is requested label Jun 28, 2022
@jrieken jrieken added the verified Verification succeeded label Jun 29, 2022
@jakebailey
Copy link
Member Author

This has been working great, but I did notice that syntax errors aren't caught in the same way; the REPL frame doesn't seem to be in the trace when that happens, confusingly.

@connor4312
Copy link
Member

It makes a bit of sense: we append //# sourceURL to identify REPL scripts, but if the script fails to parse V8 probably aborts and throws before it gets to and assigns that URL.

@jakebailey
Copy link
Member Author

jakebailey commented Jun 29, 2022

Even weirder, in that eval is not even in the stack at all:

image

You can see this if you just try using eval; the best one can do is to wrap the eval in another eval:

image

But, that's not very helpful for traces when there isn't a syntax error as eval would be doubled. I would really think that these types of errors would include eval, but that'd be a V8 thing to change, and wouldn't help the debugging experience if sourceURL isn't parsed.

@jakebailey
Copy link
Member Author

Why Chrome/Edge's debugger gets an anonymous:... and VS Code does not, I have no idea. Maybe that would help.

I can file a bug for syntax errors to not keep talking on a closed issue; I forgot to test syntax errors when I was working on my PR to close this issue.

@jakebailey
Copy link
Member Author

@connor4312 Was the fix for this reverted at some point? I back to getting huge backtraces when I make typos.

@connor4312
Copy link
Member

I've anecdotally seen this, but of course now that I try to reproduce it, am having trouble hitting it. If you hit this again before I do, can you share where you were and the contents of your debug console?

@jakebailey
Copy link
Member Author

I also somehow cannot reproduce it. Very confusing. I will keep my eye out and get some sort of backtrace the next time it happens.

@jakebailey
Copy link
Member Author

Just had it happen; I was given this trace:

links.type
Uncaught ReferenceError ReferenceError: links2 is not defined
    at eval (<eval>/VM46947599:1:1)
    at getTypeOfVariableOrParameterOrProperty (/home/jabaile/work/TypeScript/src/compiler/checker.ts:10949:20)
    at getTypeOfSymbol (/home/jabaile/work/TypeScript/src/compiler/checker.ts:11354:20)
    at getNarrowedTypeOfSymbol (/home/jabaile/work/TypeScript/src/compiler/checker.ts:27378:22)
    at checkIdentifier (/home/jabaile/work/TypeScript/src/compiler/checker.ts:27547:20)
    at checkExpressionWorker (/home/jabaile/work/TypeScript/src/compiler/checker.ts:37271:24)
    at checkExpression (/home/jabaile/work/TypeScript/src/compiler/checker.ts:37209:36)
    at checkNonNullExpression (/home/jabaile/work/TypeScript/src/compiler/checker.ts:30717:33)
    at checkPropertyAccessExpression (/home/jabaile/work/TypeScript/src/compiler/checker.ts:30813:81)
    at checkExpressionWorker (/home/jabaile/work/TypeScript/src/compiler/checker.ts:37305:24)
    at checkExpression (/home/jabaile/work/TypeScript/src/compiler/checker.ts:37209:36)
    at checkExpressionStatement (/home/jabaile/work/TypeScript/src/compiler/checker.ts:40554:9)
    at checkSourceElementWorker (/home/jabaile/work/TypeScript/src/compiler/checker.ts:44189:24)
    at checkSourceElement (/home/jabaile/work/TypeScript/src/compiler/checker.ts:44043:13)
    at forEach (/home/jabaile/work/TypeScript/src/compiler/core.ts:41:28)
    at checkBlock (/home/jabaile/work/TypeScript/src/compiler/checker.ts:40043:13)
    at checkSourceElementWorker (/home/jabaile/work/TypeScript/src/compiler/checker.ts:44185:24)
    at checkSourceElement (/home/jabaile/work/TypeScript/src/compiler/checker.ts:44043:13)
    at checkFunctionOrMethodDeclaration (/home/jabaile/work/TypeScript/src/compiler/checker.ts:39677:9)
    at checkFunctionDeclarationDiagnostics (/home/jabaile/work/TypeScript/src/compiler/chec

Half related, but links2 is definitely not the correct name to use when I type "links"; the raw source code says it's just called "links" so I don't know why it decided to rename it. I'll report that one as a different issue.

@jakebailey
Copy link
Member Author

Actually, that is relevant. This only happens when the renaming is wrong. If I type links1 or even links2, the trace is properly truncated.

@jakebailey
Copy link
Member Author

Reported as #1542.

@connor4312
Copy link
Member

connor4312 commented Feb 23, 2023

It's our old friend sourcemap renames: in renaming identifiers, the program is re-generated from its AST, and Acorn is not aware of comments, so the sourceURL is not set in any expression that uses a renamed identifier

@connor4312 connor4312 reopened this Feb 23, 2023
@connor4312 connor4312 removed feature-request Request for new features or functionality help welcome Issues identified as good community contribution opportunities verified Verification succeeded labels Feb 24, 2023
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug and removed verification-needed Verification of issue is requested labels Feb 24, 2023
@connor4312 connor4312 modified the milestones: June 2022, March 2023 Feb 24, 2023
connor4312 added a commit that referenced this issue Feb 24, 2023
* fix: repl stacktrace with renames showing too much info

Fixes #1259

* fixup! tests
@joyceerhl joyceerhl added verified Verification succeeded author-verification-requested Issues potentially verifiable by issue author and removed verified Verification succeeded labels Mar 22, 2023
@DonJayamanne DonJayamanne added verified Verification succeeded and removed verified Verification succeeded labels Mar 22, 2023
@rebornix rebornix added the verified Verification succeeded label Mar 23, 2023
@rebornix
Copy link
Member

Confirmed that it's showing long call stacks in VS Code Stable but not in Insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
6 participants