Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why VS2019 get suddenly very slow and laggy while trying to debug a c# application?

I am working on a c# code for the last couple of weeks and I debug it very often.

VS 2019 was working properly but suddenly it got very slow and laggy when I tried to debug my code. I checked all resources on my machine. All seem as before and are available enough.

Even I checked the same IDE with other codes. All runs and debugs fast enough as before. I also updated my IDE to the last version (currently 16.8.5 by the end of February 2021).

Did anybody has the same experience with the VS2019 ever?

Thanks in advance.

like image 987
amirfg Avatar asked Dec 23 '22 15:12

amirfg


2 Answers

Not sure whether the issue is caused your code with IDE environment together. Please try the following suggestions:

1) disable any third party installed extensions under Extensions-->Manage Extensions-->Installed to check whether an extension caused that.

2) reset settings under Tools-->Import and Export Settings-->Reset all settings and you can also make a backup of the settings

3) close VS, delete all files under C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache

and also delete .vs hidden folder under your solution folder, bin and obj folder.

4) type devenv /safemode under Developer Command Prompt for VS to start a pure VS and then try your project.

5) create a new project with your same code and check if this works.

Besides, if all do not help, you could try a small reproducible sample with us.

like image 184
Mr Qian Avatar answered May 27 '23 00:05

Mr Qian


If debugging suddenly becomes slow, you might consider checking your symbol settings and debugging settings. If you for example enable .NET framework source stepping, debugging can be slow, or if you do not cache symbols or disable for example Just My Code or enable other stuff, like IntelliTrace or install a bad extension.

It might not be an alternative for you, but I am pleased to inform you that I have been using Visual Studio 2022 and it is radically faster. Yes, this is not opinionated, this is an observation. It IS faster. Maybe it is because I do not have many extensions on it, but it is also a 64-bit application with less memory pressure on the GC. So you can first check your settings and then give VS 2022 Preview versions for a spin. I have used it for months and the amount of bugs are rather small if you do typically development. For a Preview version, I am impressed with what they are working for nextgen Visual Studio.

You should also clean your solution and delete and bin and obj folders via for example Powershell script to make sure your binaries are updated. Then rebuild.

like image 45
Tore Aurstad Avatar answered May 27 '23 01:05

Tore Aurstad