The indentation behaviour of Visual Studio 2022 version 17.4 has changed.
Has anyone figured out how to make it behave like it did in 17.3?
I have this typed:
Then I hit [enter], and I get
The cursor is now indented, as opposed to being under the 'f' like it used to in previous builds.
If the statement "foo" was a valid statement, then the cursor does not get indented.
Obviously, I could just write perfect code from top to bottom without ever typing an incomplete statement, but I'm just not that good :-/
It's worse than that. The option Text Editor->All languages->Tabs->Indenting (or Text Editor->any language->Tabs->Indenting for that matter), which is a radio between None, Block and Smart, is completely botched - in 17.4, no matter what you set there, you get the "smart" behavior. Way to go Micro%$#^.
Btw - upon seeing this, I made the mistake of my life - roll back Visual Studio to the previous version (using the Rollback button in the VS installer) - that fixed the Indenting behavior, but completely reset all of my Visual Studio settings, including colors, everything. Starting with a blank slate. Thank you, thank you, thank you MS.
After my testing, I reproduced your problem, this is a bug.
I suggest you post this to the dc forums and attach the relevant link to the question.
Related
Either something has come undone in my brain overnight, or there has been a change to my instance of Visual Studio that I made by accident. I was running v17.3.1 and just updated to v17.3.4 to see if it would fix the issue, but it has not.
For the last few years of pushing out lines of sub-optimal code, I have gotten a space when I pressed the spacebar and a period when I push the period button. I use intellisense a great deal, to the point that when I want to log something, I type logger.in[tab] and I get logger.LogInformation written, waiting for me to type what I want logged.
This morning, my code was way worse than usual. I wasn't getting spaces or periods being typed to the screen. Initially, I thought it was my keyboard, but a quick test showed that my keyboard was fine. Then I noticed that when I would press either the period or spacebar buttons, the intellisense would complete the selection but not insert the space or the period.
Even trying to create a new variable is painful. Typing string[space]myString leaves me with stringmyString in the IDE.
Double tapping the space or period button feels really unnatural to me. Does anyone know what options I may have accidently changed, or how I can get it back to how it was working yesterday?
Thanks in advance.
EDIT: I thought I had fixed it with Edit -> Intellisense -> Switch between automatic and tab-only Intellisense completion, but then I had to double click on the autocomplete that I wanted for it to insert it.
You can open the visual studio installer and Repair the VS it will solve the problem.
This issue was caused by the Telerik extension, in my case "Progress Telerik UI for Blazor". This was reported to Telerik, who quickly published a new version.
The new version of the extension (2022.3.921.3) fixed this issue.
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.
Hi I have been shifted from VS 2013 to 2015 presently. So I am not too much familiar with in depth specifications.
I like VS 2015 as it allows me to evaluate lambda expressions and also it allow to me to change values runtime.
Scenario:
In some apps (winforms tested only) I am able to edit code while debugging and yes latest code is executed always i.e I don't need to stop and run the program again and againe. Yes it is very excellent feature.
But in case of my first experience at controller in MVC I am unable to edit code and it shows me multiple reasons behind this.
Can someone explain in what scenarios I can add/delete code while debugging?
Thanks in advance!
In your visual studio go to Tools->Options-> expand debugging -> select Edit and continue and then check Enable edit and continue.
here is image of that:
see screenshot
You normally cannot edit and continue if you attached to an already running process which maybe your case if you are attached to a running MVC web project. If something was load using Reflection you will not be able to edit it as well.
I have also seen sometimes a similar message appearing during debug. I found the following from MSDN regarding code changes during debugging:
The following changes cannot be applied to C# code during a debugging session:
- Changes to the current statement or any other active statement.
- Active statements include any statements, in functions on the call stack, that were called to get to the current statement.
- The current statement is marked by a yellow background in the source window. Other active statements are marked by a shaded background and are read-only. These default colors can be changed in the Options dialog box.
- Changing the signature of a type.
- Adding an anonymous method that captures a variable that hasn’t been captured before.
- Adding, removing, or changing attributes.
- Adding, removing, or changing using directives.
- Adding a foreach, using, or lock around the active statement.
More information: https://msdn.microsoft.com/en-us/library/ms164927.aspx
So, after alot of R&D i came to know that Edit and continue is NOT available for Asp.net yet. It would be released in the final version of Visual studio 15.
source: https://blogs.msdn.microsoft.com/visualstudioalm/2015/04/29/net-enc-support-for-lambdas-and-other-improvements-in-visual-studio-2015/
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
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.