In in development experience, strange thing I am finding having a PC in a Bank and 3 times it has got errors and changed, and now I am finding issues in VS editors, that for example, short cuts like CTRL KU for uncommenting, and commenting multiple lines together doesn't work properly and my fast typing hands using such short cuts find it difficult to perform activities.
Also, I couldn't do "Undo" of code changes which is very very scary as I used to do a lot of code changes and save and run and again I used to successfully undo everything even though its saved. But I am finding these all not happening in this PC/organization for VS.
I tried googling out for any settings to enable for these features, but futile, as I see not much settings on these found. Could someone please help me out?
Under visual studio
GO to the Tools> Options
A window will pop up. Under Environment choose keyboard.
Make sure visual C# 2005 is selected.
For Comment/Uncomment in your xml file. Make Sure following settings are present there
You might have noticed that "Use New shortcut in" is "Global". In your case it might be something else.
Do the same for Edit.commentselection
Related
Typically when I implement an interface or write code for which usings are missing it is possible to press Ctrl+. (or right click and press 'Quick Actions and Refactorings...') to get a menu of suggestions on what can be done.
Among these suggestions are options to 'implement the interface' which generates stubs for the required methods/properties or 'add usings' etc.
These are no longer available to me. Various other actions are but afaik the common theme of those not being available any longer are the ones that in one way or another generates code.
None of my colleages have the same problem. I do however have the problem on ALL computers on which my account is logged into Visual Studio. So it clearly has something to do with my settings that are synced.
I have tried resetting the settings.
I have tried reinstalling VS.
I have tried to change various settings according to various slightly related tips on different forums which addresses similar issues.
I have checked the roslyn log files for any information on something going wrong.
But so far nothing helps.
I've searched various forums and it seems like ppl have experienced the same or similar issues throughout the years but I am unable to find any thread where anyone has actually found the cause of it nor a solution.
I can't say for sure but I think this started when upgrading from 17.3 to 17.4.
Worth mentioning might be that it actually still works in Visual Basic.
There seems to be no difference if it is .NET FW, Core or 6+.
Has anyone experienced something similar and have any suggestions on what can be done to fix it?
Thanks!
Based on my testing, VS 2022 community 17.4.4 still be able to use the 'implement the interface' feature:
From your description, looks like if you don't sign in, everything will be ok.
So here are two solutions:
1, Reset the settings of the C#:
2, Turn off synchronized settings on a particular computer
Otherwise reinstall the VS will be meaningless
It turns out it was the setting:
Tools > Text Editor > C# > Advanced > Analysis > Show compiler errors and warnings for: That was set to None and should be set to Entire Solution.
I changed this a while back to make VS not use as much CPU. Had no clue it affected this.
Creds to ChatGPT for solving it where no support could!
I have a problem when using latest version of Microsoft Visual Studio Enterprise 2022 (version 17.2.2) running on Windows 10 Enterprise (Version 10.0.19044 Build 19044, if that matters). The problem is that the Visual Studio "hangs" at random moments, but not completely. By that I mean that it looks like everything's fine with it, but I just can't click it. By fine I mean that for example when I'm debugging an application and VS hangs, the app is running completely normal, everything's showing up in VS and for example breakpoints are hit normally. When it happens, I can also close VS from the task bar normally and it unloads everything peacefully. Like I said - everything's completely normal, but it's like VS is behind a glass. Also, like I said - it's completely random and sometimes it hangs when VS is in the background, but it also happens when I'm writing and it freezes mid word. The cursor is flashing, but I can't type anything and VS doesn't respond to keyboard and mouse clicks.
It's not that big of a problem, but it is quite annoying nevertheless, especially when it happens few times a day, about once every 2 hours.
The weird thing about it is that it only happens when I'm doing stuff in a specific project - a VSTO plugin for Outlook written in C# (hence the tags). I can have multiple windows (and solutions) opened at one, but when it happens, only one of them freezes - and it's the window with the VSTO plugin for Outlook. I don't know if that's the problem with the solution/project or if it's something with Visual Studio.
Like I said - it's not that big of a deal, as I can just close it from the taskbar, but it is quite frustrating and I'd like to fix it. Any help would be appreciated.
EDIT: More than a month has passed and I think this question needs to be updated. During that month I updated everything - Visual Studio to version 17.2.5, ReSharper (more on that later) to version 2022.1.2 (from version 2022.1.0) and Windows to version 21H2. And nothing helped. However I have some observations that I think I have to share.
First of all - answering matthew-watson's question - yes, there is a plugin involved and it's the aforementioned ReSharper. I feel quite stupid, because I completely forgot that I had it installed since I started using this PC - I just didn't use it. When I started using it nothing (in terms of this question) has changed - because it has always been there. However I'm not sure if ReSharper is here to blame - at least not completely. I tried disabling it few times during that month and it seemed liked it helped, because there were no "freezes" when it was disabled. Usually after few hours I turned it back on - I like ReSharper and I'd rather not stop using it. But I'm not sure it really helped - maybe it is just so happened that there were no "freezes" when it was disabled, that it was pure accident, as there were days when ReSharper was enabled and there were no occurrences of this bug. Moreover other people in my office are using the same configuration as me (same PC, same software - including the same version of Visual Studio, ReSharper and Windows) and they don't have this bug. I'm starting to wonder if my PC is cursed...
Secondly - it's not just Office VSTO plugins that cause those "freezes" (hence I crossed that section out). Since I asked this question I changed the project that I'm actively working on and observed that the bug also happens in other projects. It doesn't matter what project, it happens in all of them - simple console projects, Blazor projects etc. However I am quite sure that it happens more often in VSTO projects. Recently I came back to the VSTO project I had been working on previously and the bug happened at least 5 times on one day. In other projects it happens rarer. Though - as mentioned in the original post - it is completely random. There are days when it doesn't happen at all and days when it happens every 30 minutes or so. It's really frustrating. But - as mentioned - it happens more often in Office VSTO plugins for some reason.
Also - I did try repairing Visual Studio by choosing "Repair" option from Visual Studio Installer - it didn't help.
At this point I kinda gave up on solving it - I tried every solution that came to my mind, checked everything and I couldn't find anything - neither a reason for this bug to happen, nor a solution. If one could at least point to where to search for the correct logs and how to debug this problem, I would be thankful.
EDIT 2: Another 2 weeks have passed and I'm sad to have to tell you that this question will have to remain unsolved. I have left the company that I worked for in which I had this problem and so I won't be able to test any solution. Especially that it was only I that got this "freezing" problem, so I won't be able to ask my ex-work colleagues to confirm that any solution posted here managed to solve the mystery and fix the problem.
If anyone gets the same problem, I hope you will be able to fix it and share some details with us. I'm really curious as to what might have been causing it.
On the surface the new AI-based IntelliCode for Visual Studio 2022 seems cool. So when I installed VS2022 and it asked if I wanted to allow training models on my code, I said sure because I wanted to see how it improved the developer experience.
But now that I've been coding with VS2022 for a week, I find that working with my 300K lines codebase constantly feels slow in the editor compared to VS2019. And I've even seen weird stuff where I'm sure I keyed one thing but the code got butchered to something totally different, sometimes several lines of code above where I was working. Somehow the VS2022 editor and I are not in sync. Also, while using the editor I've been hearing the fan on my machine kick in at high speeds indicating my machine is working very hard. I don't ever remember this being the case in VS2019. So my first thought to fix all this is to get back to more of a VS 2019 IntelliCode experience in VS2022.
So I went into Tools > Options > IntelliCode > General to turn of the new capabilities. I'd still like to have IntelliCode like it worked in VS2019 but I'd like to turn off the new AI powered models that are (theoretically) slowing down my editor experience. When looking at the settings, it's not clear which ones to change. Worse, it's not even clear when ones are enabled or disabled. They all show Default.
Taking a look at the Microsoft Docs doesn't help much either. It doesn't provide any info about which of these Default options are enabled by default or disabled by default.
I can guess that I probably want to disable Automatic model training and maybe C# deep-learning base model for completions. But should I be disabling others? And if I do turn off C# deep-learning base model for completions will I be disabling functionality I want that was in VS2019? I fired up VS2019 to check it's IntelliCode options and alas all the setting there are set to Default as well. So I neither know what was enabled before or what is enabled now. I only know my editor experience isn't making me happy.
Can anyone shed some light on how to configure these settings so that I have the kind of intelliCode experience I enjoyed in VS2019 without all the overhead of the additional AI IntelliCode features added in VS2022?
So this is what worked for me. I went to Tools > Options > IntelliCode > General and selected `Disabled' for the following:
"Apply completions for whole lines on right arrow"
"Show completions for whole lines of code"
"C# team models for completions"
"Automatic model training," and
"C# deep-learning bas model for completions"
The above are the new IntelliCode setting as best I can tell from comparing the settings to VS 2019. Once these were Disabled, the performance of my machine while in the VS2022 editor returned to normal. My editor experience now feels similar to what I had is VS2019. I'm back to being a happy camper.
While coding in C# for Visual Studio 2010, I've noticed, that for some reason, after creating a delegate method, or using the "Extract method" menu option from Visual Studio, my IntelliSense decides it wants to go overboard. It starts activating inside a string, trying to complete stuff from outside (for instance, if I type "To be continued..." as I start to type continued, it suggests "const" as an option, thinking I'm still coding, and not recognizing I'm in a string.
Also, when it starts doing the above, it also starts doing stuff like suggesting a while loop, while trying to do a Debug.WriteLine, and the Debug class has no members listed in the IntelliSense popup window, all it lists is base classes for my current namespaces.
Now if I push ctrl space manually, I get the proper intellisense options.
Sometimes, closing all open files, and reopening them fixes it; sometimes I have to completely close visual studio and reopen it to fix it.
Is anyone else experiencing similar issues, or know of any fixes to the issue?
Funnily enough, since extensions were suggested as being the cause of the issue, an extension is actually what fixed the issue for me.
It seems ReSharper overwrites default Intellisense handling, and the folks over at ReSharper seem to do it better than DevExpress, or Visual Studio, as even just installing Resharper, and uninstalling it seemed to fix it.
I've left ReSharper permanently installed on one dev environment, and have been using it consistently now for over a year, and haven't ran into this issue once, and I used to run into it weekly, or bi-weekly.
I'm generally a C++ guy, but I've got to switch to C# some of the time in order to build things for the "Windows Phone" platform. Or when I have to go to work. Whatever. Point is, I work very differently when I'm in C++ than when I'm in C#.
I'd like to have a quick and fast way of switching between these two. I know there's a "save all settings" and "restore all settings" bit, but it's awfully slow to fire up the IDE using the wrong settings, reload the other settings, close the IDE back down again, and then restart it. Ideally, I'd like to key these settings based off what kind of project I have open. E.g. if a C++ project exists in the solution, use C++ settings, otherwise use C#/XAML settings.
Does such an extension exist?
Not exactly an extension, but take a look at this blog post by Sara Ford: Did you know… You can create toolbar buttons to quickly toggle your favorite VS Settings?