Dennis Stratinski
Dennis Stratinski

Reputation: 381

My VS code keeps crashing when opening it

I have tried uninstalling and reinstalling it, but the problem did not dissappear. It seems that when I open the app, more than 20 windows open at the same time, causing the app to crash. Here is a screenshot: Desktop screenshot

I've searched on the internet for what else to do, but I didn't come across any solution.

Upvotes: 15

Views: 39521

Answers (9)

rahul_eth
rahul_eth

Reputation: 132

for ubuntu user's

cd ~/.config/Code/Backups/

then revert to the previous commit

code reverted to dc96b837

Upvotes: 0

Ivan Vlahov
Ivan Vlahov

Reputation: 121

I had the same issue with the May 2024 version (snap hash 89de5a8d) on Ubuntu 22.04. None of the answers above worked for me, so I tried removing it and installing the April 2024 version (snap hash dc96b837), this fixed the issue.

Edit: if you don't want snap to automatically update VS Code, use snap refresh --hold=720h code, it will keep snap from updating VSC to the buggy version for 30 days. You can also use --hold=forever if you don't want it to update at all.

Upvotes: 10

Amin Setayeshfar
Amin Setayeshfar

Reputation: 908

I am just reposting the answer from Chesedo's comment to be sure everyone can see it.

it is a problem with the latest release and for now, you can fix it by reverting to the last version

snap revert code

Upvotes: 44

Ak777
Ak777

Reputation: 396

As of 2023-Oct: I have the latest version of VS Code (System wide version and not user type version).

My VS code used to keep crashing whenever i open with a dialog prompting me to choose one among the 3 (Retry | Cancel | Keep Waiting). Mostly, first 2 attempts will crash eventually even if i click Retry/Keey Waiting. That tells me like some plugin/extension was taking time to load and until that settles down, neither action on the dialog helps me to retain but from 3rd attempt, it allowed me a sec or 2 at least to respond click on "Keep waiting". That will at least dont let the VS Code to crash itself but will stay on load.

I had the below extensions that i eventually removed and that kinda sorted out for me.

  • Oracle VS Code tools
  • sqltools
  • Azure Connect
  • Azure Devops pipelines
  • github pull requests and issues
  • Microsoft Edge tools for VS code (disabled)
  • Angular snippets
  • Python snippets (not published from MS)

I am not saying these extensions are culprits, but my VS Code is on my work device and that goes through network/security scans and things, i felt may slow down and these are not needed for me now. Some that may try to utilize resources in syncing/network folder paths are also a factor.

I also had some tabs from OneDrive although they are having a local version, but the path is part of the OneDrive sync folder. I had to close them too.

After these are done, it's better and not crashing at all for me. Tried testing it by opening and closing it multiple times although they are slow to show up for full use.

In summary:

  • any files that are opened and kept open tab from network drive/path, like OneDrive or other shared folder path --> dont keep it as open tab.
  • any extensions that are no longer required (remove them)
  • any extensions that has alternate tools to manage like Oracle, sqltools etc can be removed
  • any extensions that may require more scanning, scrutiny from work/corporate security, better be disabled/lazy load/ondemand load/enabled. (this may vary by each person's use case, for me, i assume, github pull requests and issues, third party extensions like sqltools, network touching extensions)

Upvotes: 0

Matt Eland
Matt Eland

Reputation: 376

I also encountered this issue and Andrew's suggestion didn't work for me, but the --disable-chromium-sandbox flag did:

code --disable-extensions --disable-gpu --disable-chromium-sandbox

Upvotes: 4

Meera K
Meera K

Reputation: 45

I observed that after installing the extension 'Django Template Support' the VSCode started crashing. I tried by installing the latest version of VSCode too. Still the VSCode did crash.

Once after uninstalling that extension, VSCode is working fine.

May be, we should note the change which has made the VScode to crash (though, it shouldn't, I believe.)

Upvotes: 0

Sathya Thangamuthu
Sathya Thangamuthu

Reputation: 1

I had the same issue with the latest version of VSCODE. Then i tried installing "Downloads: Windows: User" one from https://code.visualstudio.com/updates/v1_52. It worked. I am not sure of the root cause.

Upvotes: 0

Carl Andersen
Carl Andersen

Reputation: 629

I tried all the fixes above when my Ubuntu install of VS Code crashed repeatedly at startup. The only thing that worked for me was deleting the entire ~/.config/Code/Backups folder. Back it up first, just in case!

Upvotes: 4

Dennis Stratinski
Dennis Stratinski

Reputation: 381

The solution was to start VS Code from the command prompt with the following command:

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

Then to close all open tabs and correctly exit VS Code without any open files. Hopefully this helps someone!

Upvotes: 12

Related Questions