Repository: vscode
Issue: Git preview crashes, invalid range
Labels: bug,diff-editor

Type: <b>Bug</b>

Hard to replicates as it happens very infrequently and only with some files. When I try to open git diff of some file via Source Control tab/section sometimes it happens that this screens shows up and git diff in files stops working - files are still marked as changed but file explorerúviewver doesn't show any detected changes,

<img width="1072" alt="Snímek obrazovky 2024-03-25 v 11 05 58" src="https://github.com/microsoft/vscode/assets/4237724/469765b1-114e-433b-94d9-4c455488c492">

VS Code version: Code - Insiders 1.88.0-insider (b0d975fc6370f15570c380f41015b1ca2cdcb791, 2024-03-25T05:50:48.433Z)
OS version: Darwin arm64 23.4.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Pro (10 x 24)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|4, 4, 3|
|Memory (System)|32.00GB (1.54GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (59)</summary>

Extension|Author (truncated)|Version
---|---|---
better-comments|aar|3.0.2
Bookmarks|ale|13.4.2
project-manager|ale|12.7.0
vscode-zipfs|arc|3.0.0
color-info|bie|0.7.2
vscode-tailwindcss|bra|0.10.5
simple-react-snippets|bur|1.2.7
path-intellisense|chr|2.8.5
gitignore|cod|0.9.0
vscode-markdownlint|Dav|0.54.0
vscode-eslint|dba|2.4.4
githistory|don|0.6.20
es7-react-js-snippets|dsz|4.4.3
gitlens|eam|14.9.0
EditorConfig|Edi|0.16.4
prettier-vscode|esb|10.4.0
auto-rename-tag|for|0.1.10
c-cpp-runner|fra|9.4.7
copilot|Git|1.175.784
copilot-chat|Git|0.14.2024032501
go|gol|0.41.2
vscode-graphql|Gra|0.9.3
vscode-graphql-syntax|Gra|1.3.5
rest-client|hum|0.25.1
svg|joc|1.5.3
contextualduplicate|laf|0.2.0
vscode-language-babel|mgm|0.0.40
git-graph|mhu|1.30.0
dotenv|mik|1.0.1
vscode-scss|mrm|0.10.0
black-formatter|ms-|2024.0.1
debugpy|ms-|2024.2.0
flake8|ms-|2023.10.0
python|ms-|2024.2.1
vscode-pylance|ms-|2024.3.1
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.8
vscode-jupyter-slideshow|ms-|0.1.5
cpptools|ms-|1.19.9
vscode-versionlens|pfl|1.9.2
material-icon-theme|PKi|4.34.0
vscode-yaml|red|1.14.0
rust-analyzer|rus|0.3.1896
multi-command|ryu|1.6.0
vscode-fileutils|sle|3.10.3
code-spell-checker|str|3.0.1
code-spell-checker-czech|str|1.0.6
svelte-vscode|sve|108.3.3
sass-indented|syl|1.8.29
vscode-mdx|uni|1.8.2
errorlens|use|3.16.0
vscode-lldb|vad|1.10.0
intellicode-api-usage-examples|Vis|0.2.8
vscodeintellicode|Vis|1.3.1
vscode-icons|vsc|12.7.0
vscode-nginx|wil|0.7.2
dictionary-completion|yzh|1.3.1
material-theme|zhu|3.17.0


</details>
<!-- generated by issue reporter -->

Error log from Output -> Window:
```
2024-03-25 11:02:28.333 [error] Error: Invalid range: [-1714, -1735)
    at new C (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:97:35488)
    at C.ofStartAndLength (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:97:35412)
    at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:628:43654
    at p (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:14858)
    at w.t (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:628:43025)
    at h._runFn (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:628:42629)
    at h.k (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:12945)
    at h.endUpdate (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:13284)
    at u.finish (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:15414)
    at p (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:14873)
    at c (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:85:15086)
    at O.setModel (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:773:156131)
    at E.setInput (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2355:8265)
    at async r.S (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2353:24784)
    at async r.L (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2353:23348)
    at async r.openEditor (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2353:22337)
    at async vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2476:24165
    at async vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2359:37607
    at async pt.xc (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2749:138937)
```