My installation of Visual Studio was fine previously, but has started acting weird lately. Some of the symptoms include
Visual Studio randomly hangs or crashes
Visual Studio won't start
Intellisense disappears sometimes
Plugins are not working, or are failing to start
I can't install or uninstall tools
I can't connect to source control anymore
Certain known good project types fail to load properly
Known file types don't have syntax highlighting anymore
I can't add files to a solution because the option is greyed out
I can't add, remove, or update files to a solution due to an error
I can't add or remove projects to a solution due to an error
I can't open a solution due to an error
The debugger cannot launch, or attach to processes
I can't find any templates when I try to add a new item
I can't copy/paste due to an error
A DLL required by Visual Studio is missing or corrupt
Menus are suddenly empty
Something that I know should normally work, now does not work
How can I fix this?
(This question is meant to be a canonical close dupe for these types of questions)
Visual Studio is pretty reliable, and most of us using it aren't experiencing the issues you are. It's a pretty large and complex suite of components, though, which means problems are bound to occur.
First: Restart Visual Studio and, if that fails, restart your computer
The majority of small issues are fixed by restarting Visual Studio. Some of the ones involving connectivity or services can be fixed by restarting your computer.
If this doesn't fix your problem
There's no way to guarantee that something bad won't happen to a particular installation of Visual Studio. The ways a large, complex application can become misconfigured or damaged are too varied to mention.
The effort it would take to diagnose and track down every possible cause is great. Ain't nobody got time for that. The one reliable solution—which works almost every time it's tried—is:
Reinstall Visual Studio.
Go ahead, rest your eyes for a little bit. Come back when you've come to terms with this sad fact.
…
Resigned? Okay. We're going to go through the steps to fix your problem, starting with the lowest impact, but probably least likely to work, one first. While you are attempting to fix this, keep notes! Mentally, or write them down. If you get to the last step, you'll need them.
First, let's go the easiest route and return Visual Studio to its original state. We can do this by removing all extensions and by resetting all settings.
Open the "Extensions and Updates" dialog. If you can't find it, type that into the quick launch. If you can't find that, try ctrl-q. For each installed extension, highlight it and click the Uninstall button.
Next, let's reset those settings. Make sure you export them first!
From the docs:
To export your settings
1. On the menu bar, choose Tools, Import and Export Settings. Choose the Export selected environment settings option button, and then
choose the Next button.
2. Make sure that the check boxes for the kinds of settings that you want to export are selected and all other check boxes are cleared, and
then choose the Next button.
3. (Optional) Name your settings file, enter a different path where it should be saved, or both. By default, setting files are named
Currentsettings.vssettings and saved to %USERPROFILE%\Documents\Visual
Studio 2015\Settings.
4. Choose the Finish button.
You can import them later from the same location. Now, once you've saved your settings, go back and reset them.
Tools -> Import and Export Settings... -> Reset all settings
Having reset everything, try to repro your issue. Still breaking?
Heck.
There's no doubt that you need to reinstall. Let's go the easiest route and do a repair. Do the following:
Go to Control Panel > Programs > Programs and Features
Select Microsoft Visual Studio [whatever edition] [whatever year]
Click "Change"
Click "Repair"
After you've done this, try to repro your issue. Did it still happen?
Damnit, sorry.
If you want to try a different way, you may be able to do an "overlay" reinstall. Simply run the installer directly and select "install" (if this option is available to you). You can use your original media, but I'd strongly suggest you re-download the installer. This will overlay a new version over the old, without messing up your settings. After reinstalling, try to repro. Did it?
Aw hell. Here we go.
You need to try uninstalling/reinstalling. First, though, you might want to export your settings. You should have done this for step one of this answer, but if you didn't, go back and follow the instructions to do it now.
After saving them, repeat steps 1 and 2 (from the repair instructions) and this time select "Uninstall" instead of "Change". If your issue has to do with an external component, search for it in the list of other installed applications and uninstall it as well. If you're paranoid, uninstall everything Visual Studio related. They may be out to destroy you.
Now, reinstall Visual Studio. If you've found yourself at this point, you're in deep, so don't risk installing from your original media. Download a fresh, fully updated copy from where you originally got it. For example, if you got Visual Studio via your MSDN subscription, go there and download the ISO.
Now, having reinstalled everything, try to repro. Did it happen again?
F##&ing s#!t.
Now is the time to create a bug report. Go to Connect
https://connect.microsoft.com/VisualStudio/feedback/LoadSubmitFeedbackForm
Provide as much information as possible. You need to give them all the info they ask for in the form, plus details about the bug, how to repro it, and what you did to try and fix it. Remember those notes I told you to write down? Bust them out now. I'd strongly recommend you mark your issue public, as it may be found and commented on by others with your problem.
Within a day you'll get a response. They will probably want you to turn on Visual Studio logging and repro the issue. I won't tell you how to do this here, as they will give you exact instructions for the version of Visual Studio you are running. Follow them and reply as soon as you can.
There will be one of three outcomes from this process:
They will tell you that you're doing it wrong
They will discover an outside actor causing the issue
They will discover a bug
For #1, stop doing that, and you're done. For #2, they'll probably tell you to uninstall the bad actor (e.g., remove a plugin) and go tell the people responsible about the bug (don't slack--do it). For #3, they'll triage the bug and it will be fixed sometime later. It's likely they will suggest workarounds that will at least get you moving again, if it's a true bug.
And that's it. Now, go forth and reinstall Visual Studio!
Related
I have used go to declaration to view the source code of objects/methods that are declared in the other projects within the same solution. It has been worked great. Suddenly, the go to declaration option is not available after I highlighted the method, and I don't see it in the content menu.
Note
1) I always reboot the machine every day
2) I have been working on the same project for the past few weeks. I have been working on the same solution file before and after go to declaration menu is gone
I did make a lot change on the solution. I recompiled the object so many times. Not sure, if I accidentally cause any problem
Right now, I have to traverse to different project in the solution to find the source code. I can also put the break point. Once the program stops at that break point, I can step into the code.
More about the project, many objects/classes and defined in the other projects. Technically, they are external DLL. I know how to debug external dll, but it is cumbersome. Therefore, I include those projects in the solution (actually, the developers at my show include most of them. Then I included more). Go to definition always navigates back to metadata, but go to declaration will go back to the actual code. It is a wonderful tool, but I cannot see it anymore in the past few days.
Any thing I can do to revive this menu. Oh, I did try ctrl-f12. It does not work
Thanks
Ok
I finally figured out what happened. It was resharper that was causing the problem. What happened was I had to change my machine 3 weeks ago. I slowly installed more and more software. Then I applied the product key. Then one day, the go to declaration disappeared. I did not even notice that
Intellisense and code suggestion not working in Visual Studio 2012 Ultimate RC
The above link is the long thread that has various resolutions. Different people may encounter different issues. I have tried various resolutions (restart the visual studio, etc), and none of them work.
Resharper->Options->IntelliSense->General Set to 'Visual Studio native IntelliSense
This one works for me. Oh, you need to get your R# license to have this feature turn on
Is there C# interactive window for VS 2013, or any other similar way, without installing VS 2012.
I tried C# Repel, C# Snippet Compiler and Mono Command Prompt, but, all of them don't provide the features of C# interactive window packed with Roslyn for VS 2012.
UPDATE: Found a total better alternative!!! Try CShell, it is free and open source! "A simple, yet powerful, C# scripting IDE" as they promote it.
Check my tweet which was also favorited by Scott Hanselman :)
My old recommendation was: LINQPad
Best way is to install VS 2012 and use C# interactive window provided with its Roslyn. While doing that, wait Microsoft to release C# interactive to VS 2013.
This is taken from one of the links above:
http://social.msdn.microsoft.com/forums/vstudio/en-US/0da45fe7-fbe2-4074-b52f-dc8d7c4b2ba3/c-interactive-in-vs-2013
It worked for me, so hopefully this will help the next person :)
Hi SpencerGR,
I just got upgraded to VS 2013 and wanted C# Interactive, and this is
the first hit when I searched for it, so I figured I would place my
answer here...
Didn't make sense to me that the extension from VS 2012 wouldn't work;
so I hunted down the Roslyn keys in my registry for VS 2012 and was
able to kinda figure out what was going on. After a bit of futzing
around, I finally got it working, so here's the instructions for
whoever might care to try [be warned, I'm sure this isn't supported by
MS, I take no responsibility if something happens to mess up your
computer, and so forth ;)].
Basically it was a matter of
copying some registry keys with slight modification copying some files
and this one is annoying but oh, well] there's a file you have to
change the datestamp on (I did it by opening the file in Notepad++ and
saving it out.) If you don't already have VS 2012 or you don't have
the Roslyn CTP installed you'll need to get the files somehow, and I'm
not sure if there are other registry settings needed or not, but I
imagine if you just manage to get the files out of the CTP distro it
would be enough... No guarantees of course.
Not-Instructions-Just-An-Explanation-Of-What-I-Did-I-Am-A-Trained-Professional-...-Or-Something
;)
copying some registry keys with slight modification; I replaced '11.0' with '12.0' in the keys and values, you might need to change
the paths too if you didn't install Visual Studio in it's default
location. (also posted to pastebin.com/XeP5ai8F )
Save this as a .reg file and open it to import the new keys easily:
Windows Registry Editor Version 5.00.
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\InteractiveWindows\0] "ContentType"="Roslyn C#"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\InstalledProducts\Roslyn] ""="Microsoft Roslyn CTP" "ProductDetails"="Microsoft Roslyn CTP"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Packages\{c5edd1ee-c43b-4360-9ce4-6b993ca12897}] "Class"="Roslyn.VisualStudio.CSharp.Repl.CSharpReplPackage" "CodeBase"="C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\Extensions\\Microsoft\\Roslyn C# Interactive Window\\1.2.20906.1\\Roslyn.VisualStudio.CSharp.Repl.dll"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Packages\{f5199a4e-6a60-4f79-82e9-fc92a41c4610}] "Class"="Roslyn.VisualStudio.InteractiveWindow.InteractiveWindowPackage" "CodeBase"="C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\Extensions\\Microsoft\\Roslyn Components\\1.2.20906.1\\Roslyn.VisualStudio.InteractiveWindow.dll"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\ToolWindows\{2d0a56aa-9527-4b78-b6e6-ebe6e05da749}] "Name"="Roslyn.VisualStudio.InteractiveWindow.VsInteractiveWindow"
copying some files; basically just need to copy the files mentioned above to the locations mentioned above; I just copied the
'Common7\IDE\Extensions\Microsoft\Roslyn C# Interactive Window' and
'Common7\IDE\Extensions\Microsoft\Roslyn Components' folders from my
11.0 install to my 12.0 install. easy peasy.
and yeah... there's a file in the aforementioned 'Common7\IDE\Extensions' directory called
'extensions.configurationchanged'; I couldn't get things to take, then
I noticed that file. so, as mentioned, I just opened in Notepad++ and
saved back out; I think I had to make a change to the file, so I added
a space. kinda felt kludgy, but I guess it beats VS taking longer to
load due to having to scan the Extensions every time you open it up.
So, that's it! Worked for me, I hope someone else may find this
useful, as it probably took longer to post this than it did to
actually get it working in the first place. ;) It's possible I missed
a step in here somewhere, since I had made a few other attempts before
I found the 'changed' file, so I could have possibly twiddled another
bit somewhere that was necessary that I don't remember. Should be a
good start tho.
I haven't tested it out fully by any means but it shows up in the
'View > Other Windows' list, it opens up just find, and it looks like
Intellisense is working too. Good luck and great code to all! :)
--- Chelle L.
You could also use LinqPad. You can use it to test C# code. It has built in support for loading DLLs and Nuget Packages. Its what I use personally and I love it.
It has a free version, but the paid version has intellisense and debugger
C# interactive finally arrived to VS 2015... You may need to install vs2015.1 to get it..
http://blogs.msdn.com/b/visualstudio/archive/2015/10/08/visual-studio-2015-update-1-ctp.aspx
Good luck... and happy interactive coding!
IWIH describes how to install it and which prerequisites you need.
Let me give you some
Additional information:
After you have installed VS 2015 and its updates (update 3 KB3165756 patch has just arrived) you can bring C# interactive to your screen as follows:
Either via the menu
View -> Other Windows -> C# Interactive
Or press Ctrl + Q and type into the quick launch box:
C# interactive
which allows you to click on View -> Other Windows -> C# Interactive with the mouse.
Afterwards, you have the C# Interactive beneath the error list. Here is an example how you can use it:
Quickstart:
To get help in this window, type #help and press enter.
To execute a statement, simply press ENTER. To type in multiple lines, press SHIFT+ENTER for each line, and for the last line press ENTER to execute the entire statement.
To print the values of a variable, type its name and press enter (in the screen shot, I have done this for variable q)
I am having great problems running the application in the debugger from Visual Studio 2008.
When I'm using vshost.exe, it says:
And when vshost.exe is turned of, it simply states:
Interesting thing about it is that when i do use vshost, debugger is actually started and breakpoint is hit on the first line of the Main().
I tried:
rebuilding the project(s)
removing .ncb, .suo, .user for the projects
repairing Visual Studio 2008
changing the build architecture for the project
... no help there...
Any experience in (trouble)shooting that?
More info: some projects DO work, and one that I have to work on, does not.
I have some ideas such as:
trying to create NEW project, add thing by thing to it and see at what point it will start to miss behave
work it other way around, delete project by item by item to see when it will (if it will) be working OK again.
EDIT (for google, as I see that there are many similar questions on the web):
Errors:
Error while trying to run project: Unable to start debugging.
and
Error while trying to run project: Unable to start program '....\PlayKontrol.exe'
Try upgrading your Visual Studio to Service pack 1, if you haven't already.
Did you restarted your computer? You never know how windows will react to that :).
Also be sure there aren't any keys stuck, like the ctrl or windows key.
Note that the key does not have to be visually stuck, it can be stuck for visual studio and not for the explorer.
The most common source of sudden problems like this is corruption of one of the data files that vs uses to cache information between builds.
You've tried a clean build, but this won't delete everything. A real clean build is: quit vs, delete bin, obj, debug, release folders, delete all generated files in the root - primarily ncb. Do the same for any locally built libraries that you're project references.
The easiest way to do this is if you have the code in source control, as you can rename away your entire code folder and then force a get of all the source.
You often need to do all of these things in one hit to clear the problem.
Less frequently, a reinstall of vs will sort things out (although this sounds unlikely in your case if it is only one project that breaks)
Also think carefully about anything you might have installed just prior to it failing... And remember that some install effects may not occur until the next reboot so it could be days ago. A particular cause of this are automatic windows updates and trial versions of things like the vs 11 beta.
You might try running the application from outside of VS, but have a line of code that looks like this: Debugger.Launch(); where you want your first breakpoint.
I must have done something wrong. I have a C# project in Visual Studio 2008. All of a sudden I see a lock on my classes and when I hover the class names on the top tab I see the class name as : C:\Myprojects\Oder.cs[Read Only] !
Has something weird like that happened to you before?
In my case it was a ReSharper 9.0/9.1 related issue. After clearing the ReSharper cache, I was able to edit files in my solution again.
Clearing the ReSharper cache can be done here: ReSharper -> Options -> Environment -> General and click: Clear Caches and restart your visual studio.
(The image is contained within the first of the linked JetBrains articles).
JetBrains instructions:
Ultimate Guide to Speeding Up ReSharper (and Visual Studio) - Performance degradation after ReSharper upgrade
ReSharper Online Documentation
A couple of possibilities spring to mind:
Have you added the project to source control?
Have you marked the project folder (and all it's sub folders) as read only?
Of course, someone else may have done either of these things if they have had access to your machine.
One Possible stupid thing.
Your project is still running and you forgot that. Stop debugging (CTRL + F5)
How do I know. Guess..
Restarting my computer worked for me. My project became read only in between compiles - suddenly I couldn't save changes to files, Visual Studio started presenting me with 'save as' dialog boxes, and SVN couldn't commit or clean the project because "sqlite could not write to readonly database." Checking the file properties on the files in Windows Explorer showed that none of them were marked read-only. I was able to make a backup copy of the project, then I restarted and it was fine.
Restart your Visual Studio and add the project again. Worked for me.
Close, then reopen the file.
Still a pain, but at least it's less costly than completely closing visual studio.
You can try: file -> Source Control -> Go online
IDE-integrated source control?
Sounds like your source files are or have been under source control. Many source control systems will set files to read-only when they haven't been checked out for editing.
Total Commander makes it really easy to change file attributes recursively, but most likely Windows can also do this :)
Much in line with what Morten Mertner said, (if you by chance are using TFS Source Control like I am) I did a manual checkout of the file and it resolved the issue for me.
For me the problem is that the files are locked while the application is running.
In this state, Visual Studio 2013 displays the lock icon in the file tab and when you try to edit the file, a dialog box with this message appears:
Changes are not allowed for this module as it was not built for changes while debugging or the target .NET runtime version does not support it.
In Visual Studio 2015 as well, the lock icon appears in the file tab when the application is running. but the dialog box and message are not displayed.
Stopping the application causes the file to become unlocked.
I'm using TortiseSVN for my subversion client on a Windows Server 2008 box and I've got a folder with code checked out into it.
When I go to open the solution file that's under source control Visual Studio 2008 starts and before it can even finish loading the solution from what I can tell Visual Studio crashes. I'm trying to open a solution that has VB code in it. It gives no error messages or warnings. It's just gone.
I have checked the files and they all seem fine. The solution file seems fine when I look at it with a text editor.
This is also Visual Studio 2008 SP1 and I've got all the latest .NET service packs installed.
Has anyone else seen this before and know how to fix it?
Edit: I just did an SVN export to a new directory and it still crashes in the exported directory where there is no longer any SVN attached to it.
Additionally, it crashes EVERY time I try to open the project that came from SVN.
You should be looking at the solution file with an xml editor, at least then you will get some help for subtile flaw's in the formatting or something like that.
You can also submit feedback to Microsoft on the VIsual Studio Connect site, if the bug turns out to be real.
Some commonsense things todo however would be, goto your visual studio command prompt, start off with "devenv /ResetSettings", that often helps isolate any weirdo add-on or something lke that.
Also, try to build clean with msbuild or vcbuild, then build fully with either one (i.e. if vcbuild can not build your solution, use msbuild). That can help by laying out the symbols and such and maybe clear out some corrupted file or something.
You also may have .suo files from your subversion, those are binary files that do contain some settings, it's common for people to accidentially check them in, but they are usually better off being kept on a per-developer basis (not in the source tree). The /resetsettings will likely clear these out also, but you may want to make sure.
You can also double check the path's to all of the assemblies referenced, that your not going from a 32/64 bit host, and the CLR DLL's are in different path's now etc...
One last thing, if your really stuck, you can get a stack trace and debug the crash a bit ;), see where the fault is occuring and search that module online, your'll often find that somebody may have a specific solution.
Oh yeah, also, hooker's can be trickey. Don't trust them for a minute. Make sure you set tsvn's "only load in windows exlporer" option and configure it specifically for what folders on your system have local-svn working directories, this will greatly reduce the working set for their shell extension. On most any system, over time, one program or another (apple irw.exe or adobe pdf-preloader.exe sort's of ad-ware) will try to work it's way into your shell. You should try to make sure your dev box is rather clean from anything hook's, simular to what VladV was saying...
I had a similar problem and I fixed it and afterwards I wasn't quite sure how I managed it.
It basically involved going to the tools/options menu and setting the source control plugin to none. However, I obviously had to have had the solution open in Visual Studio if doing this was to fix the solution, but yet I thought the problem was I could not open the solution.
The only possible scenario would be if I was able to open the solution, but not open any of the projects inside it, hence able to change the source control settings immediately after opening the solution.
Does that make sense?
Try opening your solution and projects files in a text editor, and looking for anything strange.
I once heard of a similar problem: a solution contained SVN bindings created by AnkhSVN, but Visual Studio had no AnkhSVN installed, and failed to open the solution without giving any meaningful error information.