visual-studio-codevscode-debugger

VS Code crashing on restart after opening large file


I recently used VS code to open a large file by opening from the command line using the command line flag --max-memory=12288mb. I was able to edit the file fine and finished what I needed to do and then closed code as normal.

By default I have the restoreWindows and hotExit settings enabled, so that when I re-open code all the previous files are enabled.

After this whenever I open a VS Code via the shortcut or context menu, it attempts to re-open the large file and crashes within ~10 seconds of starting. And displays the warning:

The Window Has Crashed

We are sorry for the inconvenience! You can reopen the window to continue where you left off

enter image description here

I tried a few steps to attempt to close/prevent the file reopening all during the functioning 10 seconds:

  1. Close the tab using the 'x' icon
  2. Using the Close Editor, Close Folder and Close Window options in the file menu
  3. Setting "window.restoreWindows": "none" and "files.hotExit": "off" to try and prevent the file from automatically being reloaded

I have also tried running VS Code with extensions disabled


Solution

  • The solution was to start VS Code from the command line again with the following command

    code --disable-extensions --max-memory=12288mb
    

    Then to close the offending file and correctly exit VS Code without any open files. This then prevent VS Code from attempting to re-open the large file when restarting.

    I believe that this is a bug in VS Code as it feels as though it should display the same warning to restart with the correct memory when re-loading files as it does when first attempting to open the file. I've raised a bug with MS here.