Fix The window has crashed error in VSC
Why is Visual Studio Code crashing on my computer?
There are two scenarios faced by users, VSCode either crashes as soon as it open or crashes in the middle of a project. Now, there can be multiple reasons for this peculiar behavior such as a corrupted file, infinite loop, etc. We will be talking about all the possible solutions in detail.
Visual Studio Code crashing on Windows 11/10
These are the things you can do to fix Visual Studio Code crashing or freezing issue on Windows 11/10. Let us talk about them in detail.
1] Update Graphics Driver
The first thing you need to do to fix the error is to update the Graphics driver. An outdated Graphics driver won’t allow you to run any games or programming apps, and they may end up crashing on your system especially if your program is long. Hence, update your outdated driver and see if the issue persists.
2] Turn off Hardware Acceleration
Next up if the issue continues then try disabling GPU Hardware Acceleration. This way VSCode will only use Software rendering which will result in a much stable experience. To do that, follow the given steps.
3] Delete Backup of Open Files
If while opening a large file, VSCode freezes and then crashes, you need to delete some files. So, open Run, paste “%AppData%” and click Ok. Now, open Code > Backup and then delete the only folder that is inside that directory. Finally, restart VSCode and see if the issue persists.
4] Reinstall VS Code
If nothing works then maybe the issue is because of a corrupted VSCode file. So, to fix the issue, you should uninstall VSCode and then redownload and reinstall a fresh copy of the software to see if the issue persists. Hopefully, you are able to fix the issue with the given solutions.
Infinite Loop causing VSCode or System to crash
Sometimes, there can be no issue with the app or your Graphics driver, but still, your VSCode crashes, or sometimes even your system crashes because of it. This scenario can be because of your implementing an Infinite Loop. If you know that you are using Infinite loop, then you must know the consequences, that is your computer may crash if you fail to stop the process. However, sometimes, we unintentionally write an Infinite Loop. Infinite Loop is nothing but a loop that has no condition that can terminate the process. For example, look at the following code. In this case, since the condition, i.e; x>4, will always be satisfied, therefore, the loop will never end. So, make sure that you are not using Infinity Loop unintentionally. If you, accidentally wrote such a loop, keep an eye on the output, as soon as you see a series of unwanted output, just end the process Ctrl + Alt + M. This way you will be able to stop the code and save your computer from crashing. Read next:
Best Free C++ IDE for WindowsBest C++ Extensions for Visual Studio Code.