Visual Studio 2017 (15.3.1) keeps hanging/freezing - visual-studio-2017

I have recently installed Visual Studio 15.3.1 Community Edition (although I suspect this affects all editions). When doing actions such as
closing SQL .sql file tabs
copying or renaming files
other actions which I can't pinpoint
Visual Studio will freeze or hang for a few seconds or permanantly. It sometimes displays "(Not Responding)" in the title bar, but not always. This is getting really frustrating.

It seems like the Visual Studio feedback system is at fault. Turning it off solved my problem.
Open Visual Studio
Navigate to Help > Privacy > Privacy Settings
Select the "No, I would not like to participate" radio button and click OK
Hopefully whatever bug is causing this issue will be fixed soon and I'll happily participate in the feedback program again!

See this issue posted a lot on the MS forums.
I struggled with it for a while. When editing XAML files, it would always freeze and hang.
Tried many solutions that didn't fixed it. Then, I found the solution that did fix it for me.
I made two changes at the same time, so I can't say for sure which one solved it, but I can guess.
First change, which probably isn't the fix, is that I added the registry keys from this page. They were missing on my system. Page has a lot of detail, but having those keys set properly can't hurt. I noticed in Process Monitor that it was missing on the following regkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup\CachePath
Second change I made, the one I'm guessing solved the issue, was deleting the 17k+ ".TRN" files inside the following directory:
%LocalAppData%\Microsoft\VSApplicationInsights\
On my computer they were in something like the following:
C:\Users\Michael\AppData\Local\Microsoft\VSApplicationInsights\vstelXXX_SOMEGUID
Going back to check now, and after three-or-so hours of work there's another 475 files in that folder. It's producing about four or five .TRN files a minute, all with encrypted data inside. Not going to speculate as to the purpose of it, but I doubt it's anything good or useful. Deleted all those, and the XAML editor in VS now works fine, or at least as well as it ever did. No more 30+ second hangs on a modern twentysome core workstation.

In the recent update of VS 2022, the program suddenly starts freezing (randomly) and the fix for me was to turn off inline hints (the thing that pops up when you double click Ctrl key).
I'm using VS for C++ so I turned it off for C++ specifically
Go to the Tools menu tab -> Options

Related

Commit C++ Intellisense suggestion with space bar in VS 2013

I have recently been exploring C++ some after using C# exclusively for quite awhile. I'm using Visual Studio 2013 and the one thing that is bugging me to death is the inability to commit an Intellisense suggestion by pressing the space bar. I have tried to edit the commit character list in Options -> Text Editor -> C/C++ -> Advanced to accept the space bar but so far I've had no luck. Coming from C# this is very aggravating. Does anybody know if it's possible to make such a change? I know I can use Tab or Enter, but in my opinion using Space is far more fluid.
Any information would be greatly appreciated.
UPDATE: Space seems to commit some suggestions but not others. if I type "std::stri", it commits "std::string". Unfortunately, Intellisense won't commit anything created by me or even common keywords. It just adds a space after what I already typed.
Further to my comment on your question, I have installed the trial version of Visual Studio 2013 (Ultimate), and can confirm that space bar does work to complete IntelliSense suggestions. Combining all comments, it would appear that it works in the following versions:
VS 2010
VS 2012
VS 2013
Here is a screenshot of my IntelliSense settings located at Tools > Options > Text Editor > C/C++ > Advanced:
As a last resort you may want to try changing all your settings back to default, as suggested in this answer:
Tools > Import and Export Settings > Reset all settings
UPDATE: After reading JoshC's comments, I have experimented a bit more and I get the problem too. It appears to be related to whether or not the item you are trying to autocomplete is a member of a type or namespace. If it is (e.g. std::string) then space will work. If it is not (e.g. void) then it will not work (but for some reason, tab will work). As per this link, you can manually invoke the "List Members feature" by pressing CTRL+J in which case on a blank line it will include items which are in the global namespace - however this is clearly not a practical solution.
I have no idea why it discriminates between space and tab in this way. If anyone is aware of a workaround please let me know and I will edit this answer again.
The following would seem to imply that there is no solution for C++:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2656132-support-committed-by-pressing-the-space-bar-in-c
When using Visual Studios 2012 for coding in C++, how do you autocomplete code selected in IntelliSense? (see comments)

Visual Studio 2012: Syntax Highlighting is turning off and on

I'm using VS2012 and I'm quite happy with it. But the problem is, whem I'm coding in C++, that the syntax highlighting is turning off an on all over again. Sometimes, the highlighting is off and I have to reload the file. Also, it highlighting is quite slow.
Does anyone know how to fix it?
I know this is a while ago but I have had this same problem appearing randomly until just now.
It would disable when the last line in a file was a single line comment. (// blah blah). As soon as i removed that the text highlighting worked again!
Edit: In this answer I assume that your problem description is correct. In other words, I'm assuming that occasionally C++ highlighting is working, and the other times the text appears as plain text: completely black and white.
My guess is you are using an extension which modifies or replaces the way Visual Studio highlights C++ code. Try temporarily disabling all of your extensions and checking again if the editor is working. Some extensions might have the Disable button disabled; in that case you'll need to uninstall the extension for this test (possibly through Control Panel → Programs and Features).
As an example of one common extension that completely replaces the C++ highlighter is Visual Assist. However, I do not personally use that product and I haven't heard of any specific problems with it of this nature. I am merely mentioning it as an example of an extension that completely changes the behavior of Visual Studio in regards to syntax highlighting of C++ code.
For me, highlighting always stops working when the first visible line in the editor begins with the characters '//' and I trigger reparsing somehow (CTRL + S for instance).
Highlighting always works fine when the first visible line in the editor begins with anything else, even with a whitespace, and I trigger reparsing somehow.
I could indent all my comments and never experience this problem, but now that I know about it, it's not so annoying anymore, so I let it be.
This is a bug in Visual Studio 2012:
https://connect.microsoft.com/VisualStudio/feedback/details/760154/syntax-highlighting-sometimes-not-working
If you're using only Intellisense, you may go to Edit->Intellisense->Toggle Completion Mode (or hit Ctrl + Alt + Space), play with it and see if it works (maybe you've pressed this combination of keys by accident).
I've also installed Update 3 and haven't had any problems since. Who knows..
I had the same problem. Disabling the extentions sadly did not work for me.
After searching around and realizing that it only happened on larger files,
I got it to work by turning harware acceleration off.
Tools->Options...->Environment->General
*Automatically adjust [...] (off)
*Use hardware graphics acceleration (off)
In my case, it turned out that a large block of code (a 200+ line method) was commented out with // starting in the first column, and this was causing the syntax coloring not to work. I changed the commenting delineation to /* ... */ for that method and all of the syntax coloring was fixed.
Personally, I found that things like:
#if 0// bla-bla
mess up syntax highlighting badly. The solution that works for is to put a space before a comment, like so:
#if 0 // bla-bla
I installed Visual Studio 2012 Update 3 yesterday and started experiencing the exact same behavior described in the original post. Based on some suggestions in this thread, I took at look at my extensions, and disabling AllMargins fixed the issue. I've since re-enabled AllMargins and everything appears to be working as it should.
Try disabling and re-enabling any of your extensions; hopefully that will fix the issue for you.

Visual Studio C++ does not update new code after building

Before anything, I will first say that I've been looking everywhere for a solution to this problem for an hour now. There are many identical problems out there but none of the solutions help me.
I'm trying to debug a small project. When I started working on the project, I could place break points wherever I wanted and I would hit them. But for some reason, now when I place breakpoints outside of the main program (in a class definition, for example), the breakpoints hollow out while the code is running and I get a message saying the source code is different from the original version.
This led me to believe it was running a previous build, so I made an obvious change by having the code output some random letters "dajfhdjhfds";
I hit F7 as usual. Got a message saying Build: 1 succeeded. Hit F5, the program runs but does not display the random letters.
I clean my solution, then build and the changes show. I 'rebuild' the solution, and the changes show. The breakpoints also work.
But then if I make further changes, the breakpoints stop working and the changes don't appear in the program. Visual Studio is always running old code. I don't want to have to clean my solution every time I want to debug new code.
I've reset my settings, I checked off "build" in the configuration manager, I even started a whole new project and copied my code into new files. Same issue.
The problem resided in the fact that I copied the code from the original project into a brand new project saved elsewhere. When I tried to build the project in the new location it would always build it in the old location (Strange since I copied code directly into brand new files).
When I tried to run the files it would look for the built code in the new location. Therefore it would always get out of date code.
Problem can be fixed by putting the new code back in the old location!
Thanks everyone
I had this problem occur also, using WinForms. I was adding message boxes to test code and nothing was happening, only the pre-existing message boxes worked. I'm not sure 'exactly' how I fixed it, but after clicking "Build Solution", "Rebuild Solution", "Clean Solution" and "Build (program name)" all under the 'Build' menu the problem went away. Unlike the previous problems I had not copied+pasted any code between solutions.
I've started running into an identical problem and I think it all started when I re-created the project under a new name.
That is, I had to copy everything.
Problem is I don't know what DIDN'T get fully copied and is now responsible for requiring a rebuild to get my code changes. Checked the solution and project files in a text editor and no signs of the old folder structure.

Visual Studio 2010 Improperly underlining code/comments with red error line when there is no error

I am working on a rather large project, and I am having strange problems with the IDE in terms of error checking and somewhat with IntelliSense.
Usually if I were to type something boneheaded, like "int a = "aa";", it would underline "aa" in red. However I am seeing VS do this to random parts of my code when I make insignificant changes.
For example:
/*
Some comment here, just going to stretch it out for my example..
*/
int proto1();
int proto2();
If I make changes to other parts of the project, sometimes random functions will get underlined, and even part of a comment. Like just 30 minutes ago it underlined the equivalent of half of that comment beginning in the middle of the word "comment", also it underlined all of int proto1(); and part of int proto2();
I would post screenshots but I am bound by contract not to disclose any work, and I can't easily replicate it in smaller projects.
I don't understand why it does this. When I compile the project, any fake errors and underlining it did goes away and it compiles fine. The point though, is there are no errors. It's making up random errors and underlining random lines/words/half words. I would also like to note that there seems to be a large delay in loading new intellisense information, almost by 2-3 minutes or longer.
I'll try and reproduce it in an unrelated project and post here if I can. However, any help would be appreciated.
Thanks!
*Edit: Forgot to note that hitting the space key several times will on occasion correct the errors however this isn't reliable and does not always work.
Intellisense sometimes can really get stuck with complicated code. I guess until VS2012 release comes out, there's nothing we can do.
There's however one trick that I'm using if this happens - switch your build configuration Debug -> Release and then back again. You don't have to wait, you can just click two times on this drop-down box. It should refresh IS cache and make red error underlines dissappear.
Intellisense is often off, but make sure you have latest updates installed.
I just installed sp1 yesterday and lot of Intellisense issues went way.
I see this is a stale question but some may find this helpful.
I just had this same issue. I tried many of the solutions outlined here and elsewhere. I finally tried running Visual Studio as another user (Shift Right Click Run As Different User) and the issue did not present. I then logged into my computer as another user and deleted the profile of the user I was having the issue with.
If your profile is important to you or there is information within it that is important I highly recommend backing up relevant information first. If you don't understand what information you profile contains make sure you do prior to deleting it.
1) Log in as different user (with admin privileges) than you want to delete
2) Open Properties for Computer
3) Advanced system settings (on the left side)
4) Settings for User Profiles (in the middle)
5) Select the profile you want to delete and click the delete button
6) Reboot
Credit to:
https://superuser.com/questions/63017/how-do-i-delete-a-user-profile-on-a-windows-7-machine-that-is-part-of-a-domain
I had the same issue, and in my case it was mostly related to library functions and types defined in libraries. This one fixed it for me:
Open command line parameters. You can use following to reach there:
Project > ProjectName Properties > Configuration Properties > Linker > Command Line
In the Additional Options box at the bottom add
/I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
You will of course need the correct path where Visual Studio is installed.
Bingo! I hope it works for you too. :)

VS2008 is very slow on a specific large C++ solution

I have a solution with 21 C++ projects and 1 VB.NET project.
The IDE responds very slowly when I simply move the carret in a file or try to open the menu. The process seems to take 50% of CPU for each movement.
It only happens with this solution and only on my machine.
The solution has total of 2380 source and header files, of which 1280 are header files.
I tried to remove all connection to the source control (Perforce) but it didn't help.
Also, I have Visual Assist installed but even after removing it (uninstall), the same behavior continued.
Any idea?
Deactivate intellisense.
Link
Intellisense parses the whole project and slows down the IDE drastically. If you use Visual Assist then you won't really need it. Visual Assist is less resource hungry and scans in the background, intellisense steals too many resources during its parsing.
Could this apply in your case?
http://coolthingoftheday.blogspot.com/2008/03/visual-basic-2008-hotfix-to-fix-slow.html
Note that disabling Intellisense may also break stuff like the Class Wizard (at least I'm pretty sure it does in VS2005). As already suggested it's a good idea to get rid of all the temporary files like .ncb regularly, because they can get huge and will slow down the IDE.
Also, if you're using Visual Assist, try rebuilding the database, disabling it or installing a different version.
I have a few solutions with over 100 projects, so I know exactly how you feel. Solutions containing some managed projects are especially bad. Disabling Intellisense helps a lot. I've never seen such problems from Visual Assist (or other similar refactoring tools), and that fills in a lot of the missing functionality from losing Intellisense.
I've also encountered some projects that had code that would cause the Intellisense thread to endlessly loop and never finish parsing the code. Most of those times we were never able to pin down the exact bit of code that caused the problem. Certain heavy use of templates and nested macros were often high on the suspicion list.
The only good way to be sure that Intellisense is disabled is to create a directory with the same name as the ncb file. Go to your solution directory, delete the ncb, and create a directory named your_solution_name.ncb. Because it can't recreate the ncb file, you'll get an error box to click through every time you open the solution, but that's a small price to pay.
Simply deleting the ncb will mean that VS will just create it again. The methods that I've seen from inside the VS options will turn off some of the features but will not prevent it from trying to parse all your code.