monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] D is null

Open cristian-5 opened this issue 1 year ago • 6 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Reproduction Steps

Open any code. Select everything (using your cursor) from the bottom line to the top line, you can overdoit by hovering outside the editor.

Actual (Problematic) Behavior

Errors on selection.

Expected Behavior

No errors on selection.

Additional Context

Uncaught Error: D is null

_doHitTestWithCaretPositionFromPoint@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:10121
doHitTest@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:11307
d/this.hitTestResult<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:642:17885
get value@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:11:18480
get target@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:642:17501
_createMouseTarget@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:2139
createMouseTarget@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:1840
_execute@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:24842
h/this._animationFrameDisposable<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:23694
execute@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:80766
Le@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:81094
e.scheduleAtNextAnimationFrame/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:81333
FrameRequestCallback*e.scheduleAtNextAnimationFrame@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:81305
h@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:23628
start@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:23226
_onMouseDownThenMove@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:19122
start/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:20392
startMonitoring/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:638:56509
startMonitoring/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:115:1299
EventListener.handleEvent*m@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:79137
u@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:79359
startMonitoring@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:115:1173
startMonitoring@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:638:56482
start@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:20322
_onMouseDown@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:17818
i/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:14474
onMouseDown/<@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:638:55175
EventListener.handleEvent*m@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:79137
u@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:114:79359
onMouseDown@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:638:55123
i@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:14426
i@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:643:30384
re@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:646:25261
_createView@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:678:20942
_attachModel@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:678:18729
O@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:703:9622
_createInstance@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:606:1552
createInstance@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:606:977
P@https://cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js:704:1213
@http://localhost:8080/:65:34
execCb@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:12861
check@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:6615
newContext/enable/</<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9036
bind/<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:814
newContext/emit/<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9498
each@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:289
emit@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9469
check@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:7174
newContext/enable/</<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9036
bind/<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:814
newContext/emit/<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9498
each@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:289
emit@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9469
check@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:7174
newContext/enable/</<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:9036
bind/<@https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js:1:814
    unexpectedErrorHandler errors.ts:26
    setTimeout handler*f/this.unexpectedErrorHandler errors.ts:20
    onUnexpectedError errors.ts:41
    k errors.ts:56
    execute dom.ts:309
    Le dom.ts:348
    scheduleAtNextAnimationFrame dom.ts:366
    scheduleAtNextAnimationFrame dom.ts:366
    h mouseHandler.ts:681
    start mouseHandler.ts:650
    _onMouseDownThenMove mouseHandler.ts:415
    start mouseHandler.ts:489
    startMonitoring editorDom.ts:258
    startMonitoring globalPointerMoveMonitor.ts:102
    m dom.ts:143
    u dom.ts:164
    startMonitoring globalPointerMoveMonitor.ts:91
    startMonitoring editorDom.ts:253
    start mouseHandler.ts:485
    _onMouseDown mouseHandler.ts:327
    i mouseHandler.ts:130
    onMouseDown editorDom.ts:165
    m dom.ts:143
    u dom.ts:164
    onMouseDown editorDom.ts:164
    i mouseHandler.ts:130
    i pointerHandler.ts:150
    re view.ts:243
    _createView codeEditorWidget.ts:1728
    _attachModel codeEditorWidget.ts:1630
    O standaloneCodeEditor.ts:455
    _createInstance instantiationService.ts:119
    createInstance instantiationService.ts:85
    P standaloneEditor.ts:51
    <anonymous> (index):65
    execCb require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1
    emit require.min.js:1
    each require.min.js:1
    emit require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1
    emit require.min.js:1
    each require.min.js:1
    emit require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1
2 [errors.ts:26:11](https://cdn.jsdelivr.net/npm/[email protected]/min-maps/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/errors.ts)
    unexpectedErrorHandler errors.ts:26
    (Async: setTimeout handler)
    unexpectedErrorHandler errors.ts:20
    onUnexpectedError errors.ts:41
    k errors.ts:56
    execute dom.ts:309
    Le dom.ts:348
    scheduleAtNextAnimationFrame dom.ts:366
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.ts:366
    h mouseHandler.ts:681
    start mouseHandler.ts:650
    _onMouseDownThenMove mouseHandler.ts:415
    start mouseHandler.ts:489
    startMonitoring editorDom.ts:258
    startMonitoring globalPointerMoveMonitor.ts:102
    (Async: EventListener.handleEvent)
    m dom.ts:143
    u dom.ts:164
    startMonitoring globalPointerMoveMonitor.ts:91
    startMonitoring editorDom.ts:253
    start mouseHandler.ts:485
    _onMouseDown mouseHandler.ts:327
    i mouseHandler.ts:130
    onMouseDown editorDom.ts:165
    (Async: EventListener.handleEvent)
    m dom.ts:143
    u dom.ts:164
    onMouseDown editorDom.ts:164
    i mouseHandler.ts:130
    i pointerHandler.ts:150
    re view.ts:243
    _createView codeEditorWidget.ts:1728
    _attachModel codeEditorWidget.ts:1630
    O standaloneCodeEditor.ts:455
    construct self-hosted:2299
    _createInstance instantiationService.ts:119
    createInstance instantiationService.ts:85
    P standaloneEditor.ts:51
    <anonymous> (index):65
    execCb require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1
    emit require.min.js:1
    each require.min.js:1
    emit require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1
    emit require.min.js:1
    each require.min.js:1
    emit require.min.js:1
    check require.min.js:1
    enable require.min.js:1
    bind require.min.js:1

cristian-5 avatar May 23 '24 15:05 cristian-5

Hi @cristian-5, does the issue still occur for you on the latest stable version of monaco-editor?

rzhao271 avatar Dec 18 '24 18:12 rzhao271

@rzhao271 Im seeing a similar issue. This only happens in firefox.

Uncaught Error: hitResult is null

_doHitTestWithCaretPositionFromPoint@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88573:9
doHitTest@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88620:21
HitTestRequest/this.hitTestResult<@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88164:60
get value@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:6848:32
get target@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88151:7
_createMouseTarget@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88257:9
createMouseTarget@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:88243:37
_execute@http://localhost:3000/@fs/workspace/node_modules/.vite/deps/chunk-M5C4FAAO.js?v=bc75ecb6:89244:46
_execute/this._animationFrameDisposable<@http://loca…
    editor chunk-M5C4FAAO.js:1312
    setTimeout handler*../node_modules/.pnpm/monaco-editor chunk-M5C4FAAO.js:1307
    onUnexpectedError errors.js:27
    onUnexpectedError errors.js:39
    execute dom.js:222
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    editor chunk-M5C4FAAO.js:10962
errors.js:15:26
    unexpectedErrorHandler errors.js:15
    (Async: setTimeout handler)
    unexpectedErrorHandler errors.js:10
    onUnexpectedError errors.js:27
    onUnexpectedError errors.js:39
    execute dom.js:222
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271
    (Async: FrameRequestCallback)
    scheduleAtNextAnimationFrame dom.js:271
    _execute mouseHandler.js:557
    _animationFrameDisposable mouseHandler.js:557
    execute dom.js:219
    animationFrameRunner dom.js:256
    scheduleAtNextAnimationFrame dom.js:271

nicolasfripp avatar Dec 24 '24 18:12 nicolasfripp

I am currently experiencing this in on Firefox 133.0.3 (64-bit).

As soon as the mouse goes above the editor element while selecting, it throws.

It's also happening pretty reliably in the playground (with latest stable - 0.52.2 at the time I write this), however there the mouse first has to go off on the x-axis (to the left or right of the preview editor element) and then it throws when it goes above (but not below).

I can kind of swallow the error (and subsequent unhandled rejection) by having window.addEventListener('error', ...) and window.addEventListener('unhandledrejection', ...) but in my context of a Svelte 4 app, I still get kicked to my global error page, which forces the user to have to refresh the page.

vgebrev-synatic avatar Dec 31 '24 11:12 vgebrev-synatic

Just a bit more info on this, there seems to be some correlation between the top of the element (I believe compared to the nearest position:relative; ancestor element, but not 100% sure), its height, and the hit test throwing.

In my app there are a number of instances of the editor that work just fine and a couple that don't. In both cases where it didn't the editor was quite far "down" in its relative DOM context and, as a workaround, reducing its height resolved the issue.

vgebrev-synatic avatar Jan 28 '25 13:01 vgebrev-synatic

I suppose there hasn't been an update on this yet?

diVid3 avatar Mar 06 '25 12:03 diVid3

Seems related to https://github.com/microsoft/monaco-editor/issues/4679.

silverwind avatar Nov 21 '25 18:11 silverwind