Visual Studio randomly adds a lot of spaces to my code - c#

I have a page open writing some code and then out of nowhere after some random time my page reformats and my spaces get turned into tabs. I have to close the file and re-open in order for it to get fixed. Please have a look at the screenshot below.
I am using c# and Visual Studio 2019. I Recently updated to the latest version of visual studio and this is when this started happening. I am now on version 16.11.4. I also installed .NET 5 at the same time so not sure if something there could be messing with visual studio.
Edit: I Think I figured out why the spaces are added. If you look at this new screenshot you will see that it injected the gray lettering where spaces were. I tried clicking around in the empty spaces few times and those gray letters showed up. I Guess the page is having trouble loading all these in until I click on them?
Anyone has any idea why?

I had the same problem when I had Resharper installed, and I upgraded to the latest version of Visual Studio.
Are you using Resharper? If yes, disable it or downgrade Visual Studio to a version compatible with your version of Resharper.

I believe this is caused by your word wrapping preferences and then resizing your window. Go to File - Preferences - Settings and then search for "wrap" and play around with the settings or turn it off.

Related

Visual Studio confusing tooltips

Newbie to C #. I guess I'm dumb and just pressed something wrong.
When I installed Visual Studio, the tips worked correctly. But after rolling back the system to the restore point created before installing VS, half of the VS files were simply deleted.
Had to reinstall Visual Studio, and the oddities started with the hints. They do not coincide at all with what I am writing.
I tried to uninstall through the installer, plus manually deleted folders in AppData and Progra Files. All the same.
Reinstalled the system. Visual Studio seems to have pulled the settings from the Internet, because the tooltips still work strangely.
Tried Tools-> Import and Export Options-> Reset All Options. Not that.
The screenshot should show that all the text is highlighted in bold green, and although I write Float, I get abstract / class / delegate in the tooltips.

Visual Studio 2019 Installer doesn't start

I'm using Windows 10 ver. 1909. Installer hangs or does nothing. No feedback.
I had exactly this problem. Same version of Windows 10. I tried both vs_community.exe and vs_professional.exe. On a Microsoft Surface Pro 4. The installer launches, a brief unpacking screen appears, that vanishes, and you're left with the task manager showing the installer but no user interface. I tried numerous different suggestions from Googling as well as the Collect.exe tool. None of that helped. Someone had a similar problem that hinted that a display could cause the problem. My Surface had Duet installed, which allows you to use an iPad as a second monitor. Uninstalling that allowed Visual Studio to install normally. Apparently the Visual Studio installer is finicky about displays so if you have any unusual display drivers, or screen sharing utilities, they should be removed to allow installing. I suspect that the driver or utility could be put back after installation.
In my case, the issue was that I have downloaded and launched the installer to a user folder that contains non-English characters. Moving the installer to another folder fixed the issue. I´ve diagnosed the issue by looking into an installer log file in C:\Users<username>\AppData\Local\Temp\dd_vs_professional__143315035.1628536728_decompression_log.txt.
At first you need to download this tool Event Collect for visual studio, open your CMD as administrator,then run Collect.exe , after that you need to run your visual studio installer in the event of an error you will find and file named C:\Users{username}\AppData\Local\Temp\VSSetupEvents.txt that you can check to see the error messages.
For more details you can check documentation .
My case is very embarrassing for Microsoft. I downloaded Visual Studio Setup and started it right away from browser. It was opened and then immediately closed. Nothing I could read on the Internet about this problem was not helping. Then I did one very simple thing. Moved setup from original location: C:\Users(user name)\Downloads, to c:\Temp -> worked like a charm. The thing is that my user name contains international characters (plus containing a space). All in all 21. century, full unicode support everywhere, but not in windows. Really embarrassing.
Visual Studio 2019 Installer doesn't start
I lost time about something I shouldn't have, I couldn't install vscode studio 2019 (I've installed it on multiple machines before).
I don't know exactly why, observed there might be something in my folder blocking it, I just moved it to a new folder and I could install. Good luck and don't make the same mistake as me

VS 2015 Community - Not checking errors until build, errors do not go away

Intellisense will still give suggestions, but Visual Studio will not highlight any errors until I click "Start". I can write absolute gibberish and no red squiggles will appear. However, when I do click "Start", the Error List will finally populate and the build will fail. (It will also check errors after I click "ReBuild" or "Clean Solution").
However, when I do edit the errors, the red squiggles will remain. Even when I remove the entire line, a two space long red squiggle will remain. Clicking "Start", "Rebuild", or "Clean Solution" does not make these old error highlights disappear and the Error List does not change. Only closing and restarting VS 2015 Community will clear them. Rebooting the computer did not re-enable the error checking function.
System Details: This is a fresh install of Windows 7 Pro 64bit on a Macbook Pro with Bootcamp. This is the first project I have made since installing VS 2015 Community yesterday. I am writing a Windows Forms app using C#. To the best of my knowledge, it was working fine for a few hours this morning. I have already tried resetting all my settings. I have already tried rebooting and deleting the bin/obj folders in the solution directory.
Has anyone experienced such an issue? Do you think it is an issue with my install, or did my solution get corrupted somehow?
A few things to try that often fix weird Visual Studio problems:
Restart Visual Studio.
Delete the .suo file. This file should be right beside the .sln file, and is a temp file used for tracking things like which files/tabs you had open in the editor between sessions
Clear out some temp VS cache files.
Another thing you can try is running VS in safe mode to run with all extensions disabled. This may at least hint if the problem is native to VS, or if it's one of your installed extensions that is the problem.
Creating a new Project caused the error checking functionality to come back. I didn't even type any new code, I only made a new, blank project and everything started working again.
I have no idea why, but if someone else encounters this issue, make a new Visual Studio project and try re-loading your old one afterwards.

Visual studio TEST missing from the main menu

After updating to visual studio 2013, update 4, the TEST option is missing from my screen, I thought Visual Studio update 5 would fix it, but it did not. "TEST" is missing from my options and I don't know why.
I have tried resetting the settings, it does not help, reset settings:
I cannot add test via TOOLS -> CUSTOMIZE -> COMMANDS -> ADD COMMAND, it is not there.
What edition of Visual Studio are you working with? Have you ever had
the TEST menu present?
Yes, I've run tests before, I'm currently
at Visual Studio 2013.5 - Premium flavor
#OP answered:
I don't know why, but uninstalling Office Tools extension seems to have fixed it.
I wanted to provide an explanation for why Menu's can go missing. One reason for this is when you install another component for Visual Studio, like Team Foundation Client or in this case Office Tools extension. They "may" automatically select a different setting. To check if this is the problem:
In Visual Studio click Tools Menu > Import and Export Settings:
See here how Project Management Settings is selected, that is the wrong setting if you're a Developer.
To see the missing developer menu's reset it back to a developer setting.
Ref: http://blog.accentient.com/a-visual-studio-mystery-the-case-of-the-missing-menu-items/
I had the same issue in VS 2015 Update 2 Community and the culprit apparently was AppInsights extension (https://github.com/dotnet/roslyn/issues/11653). To provide some detail:
Noticed test menu missing in existing solution where I previously ran tests
Made a blank test project, still no test menu
closed vs and reopened. Still not test menu
Got error referencing C:\Users{username}\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml
Last error in there was NullReferenceException in CodeLensIndicatorService
Googling that found link above, tieing to this add-in.
disabling it fixed the issue and test menu not appears and I can run tests.
Forgive me if I complain a bit, but if any VS team is reading: Under no circumstances should an add-in failing cause a built-in menu to not appear. As much as this is a bug caused by the the various add-ins, it is also a flaw in VS IMO- and one that is not trivial for end-users to connect the dots on.
Somehow the settings (settings have menu items configuration also) for your visual studio may have issue. Either you can try reset. Only in case that doesn't work you can always customize your menu item. so
Tool -> Customize (by default standard should be selected)
select commands tab and then menu bar option. You can see options to add commands. Under that you can select test so make testing option visible.
Also for testing test case, you can always right click on class and run it.
Hi Please try to reset all setting
http://blog.accentient.com/a-visual-studio-mystery-the-case-of-the-missing-menu-items/
If not then there is workaround to add your setting
http://blogs.msdn.com/b/visualstudioalm/archive/2012/09/11/visual-studio-2012-where-is-the-test-toolbar-couldn-t-find-it-anywhere.aspx
After doing close visual studio instances and reopen it.
I don't know why, but uninstalling Office Tools extension seems to have fixed it.
Edit: I tried to reproduce this bug, I ran the VS2013.5 update and clicked repair. The update took +5 hours, figured it got stuck. So I cancelled it, got stuck cancelling. So I ended the process. Now I started visual studio and TEST is missing, basically my visual studio installation is messed up I think.
Edit: Found the culprit, it was Microsoft Intune Endpoint Protection that was installed on my pc. It basically scanned everything and when visual studio got updated and files were written to the disk, something went wrong and corrupted my install. I turned it off by excluding C:\* from being scanned and ran VS2013.5 update and clicked repair. Everything is fine now.

Show unbuilt changes in Visual Studio 2012

I am looking for a plugin for VS 2012 that would show me which lines of code have been modified or created since the last build. Anyone know of something for this?
You could use a Visual Studio SVN plugin to view changes visually within Visual Studio.
EDIT: as mentioned in my comment below, the next closest thing to what you seek is change tracking. As you bring up in your comment it will only work for your purposes if the only time you save is when you build. I tend to save as often as possible though.
And yes, the default behavior of VS is to automatically save when you build.

Categories

Resources