VS 2017 WinForms project quit recognizing user controls in same namespace - c#

I have a Windows Forms Project that I have been working on for the last several months.
In this solution, I have about 10 custom user controls. A few days ago I was working on the common library that is shared across all of the forms in the application, and then when I went to open the form none of my controls were recognized.
I reverted my changes to the library and the issue persisted. Soon I got to the point where even opening the form crashed VS.
I can compile the solution fine, but I cannot use the visual editor.
None of my custom controls will show up anymore in the toolbox either. However, I can open them just fine.
After 2 days of looking online, I have tried the following, to no avail.
Dynamically reallocated my computer's memory (rebooted)
Close the solution and reopen it
Cleaned and rebuilt solution
Downloaded last release version from source control to a new directory and opened it.
Removing the controls from the project and readded them
Deleted the bin and obj folders
Deleted the .vs folder (stopped VS from crashing as soon as I opened the solution)
Followed this MSDN Article
Refreshed toolbox
Repaired the Visual Studio Installation
Uninstalled and Reinstalled Visual Studio
Copied the solution files from one directory to another
Reverted my project to an earlier commit from my source control solution
Removed all NuGet packages
Removed controls one by one
The only thing that has changed since the last time I was working on this project was that Visual Studio 2017 had recently installed a new update.
I am at a complete loss, I even resorted to going to page 4 on google.
UPDATE
This issue becomes intermittent when I run it on a fresh installation of VS within a Virtual Machine.

I had a separate DLL file that I was calling from my project for EMGU.CV. Once I removed that reference it worked fine. I created my own DLL wrapper for grabbing a Bitmap Image from the EMGU.CV library and the issue have since been resolved.
This makes sense as after I had deleted the NuGet packages, the DLL still remained, but once removed the designer resumed working.

Related

Visual studio 2019 go to definition and Intellisense not working

I have noticed a weird issue with Visual Studio 2019 v16.0.1 the IntelliSense about "Using directive is unnecessary" normally grey is missing and type reference suggestion for missing using is not working.
I also tried with Visual Studio 2019 Preview but no luck.
I have tried the following:
deleted .vs folder and restarted.
Reinstalled Visual Studio
Reset settings via import and export setting under tools
Any other suggestions will be appreciated.
Close Visual Studio
Delete .vs folder (it is a hidden folder inside the folder which contains the solution *.sln)
Start Visual Studio
Solved my problem
Update From the comments
Deleting Browse.VC.db file within .vs folder worked for me. I did this to avoid deleting .suo which has information I want to preserve
NOTE 1: I am using Visual Studio 2019, but it may work on other versions
NOTE 2: This did not solve the OP problem, but it is a good candidate to solve your
Go to Tools -> Options -> Text Editor -> All Languages -> General. Make sure “Auto List Members” is checked. Also, make sure “Parameter Information” is checked.
If you are facing this issue with Unity projects then,
Check in your Unity settings whether it has Visual Studio configured as the external editor.
Click on Regenarate project files in the Unity settings.
Go to Assets => Open C# project.
This will restart Visual Studio with your project.
In my case, Resharper is the culprit. Disabling it immediately solved the issue.
I think these issues are discussed here and are resolved by an update and some worksrounds are bring discussed:
https://developercommunity.visualstudio.com/content/problem/505489/cannot-navigate-to-the-symbol-under-the-caret-3.html
For anyone who are searching for another suggestion, I just go throught this issue, as OP said, I've deleted .vs folder, I've update vs to last version, I've uninstalled and reinstalled vs to the last version, I've reset settings, delete all obj folders, I've installed Microsoft.Net.Compilers but nothing worked, at the end I just remembered that sometimes the projects required WindowsBase library, until now I don't know why, but after adding that dll Intellisense started to function again.
I use resharper (vs 2017) but had not installed it on 2019. After installing Resharper on 2019 the intellisense started working again. (yes, it was working in 2019, then stopped)
I don't have an explanation on why this would fix it. Just did for me.
First time I use VS 2019, I need to manually install Code Analysis. Make sure it is installed at your project properties.
And today, for the new class, the suggestion or namespaces not showing for VS 2019 Intellisense, and Go to Definition not working too.
I must do close solution, and re-open and VS 2019 doing scanning while opening project, and then worked again.
I think this is bug for VS 2019. Try to close solution and re-open it.
I have tried almost all the solution mentioned above but it doesn't helped me. Trying to restart my PC solved my problem.
I tried lots of things but nothing worked for me until I found this post. He mentions a few things I have already tried that didn't work, but his final solution worked for me...
At the root of our solution there is a packages folder. I deleted the
entire contents of this folder. Upon reopening Visual Studio,
Intellisense and Go To Definition were restored to full working order.
close visual stdio
For mac in your folder: do command + shift+ .
you will see hidden files -> delete .vs folder
open solution again
After working for a few months, Intellisense suddenly stopped. This cost me a lot of lost time! I've been worked with Visual Studio for about 10 years, and this problem happens occasionally in every version.
Here's what I tried for this iteration of the problem:
Closing Visual Studio and re-opening does sometimes make the problem disappear for a short time, but it certainly doesn't solve it
Likewise restarting my laptop
Installing the latest Visual Studio 2019 update didn't help (I'm on 16.8.3 now if anyone's interested)
Deleting the hidden .vs folder doesn't seem to solve anything (doing so also means you lose your current window layout, as well as any bookmarks you've set)
Unticking the Track Changes option in this menu: Tools-> Options-> Text Editor-> General.
I've updated my NuGet reference to the Microsoft.Net.Compilers library to the latest stable version, as suggested here, but sadly this made no difference
I thought I've finally solved the problem by following the advice from Homer. I deleted the packages folder at the base level of my project (somewhat nervously, as I wasn't sure if it was needed), and thought it had solved the problem, but no such luck.
However, one thing to watch out for - after doing this, Visual Studio recognised my classes but no longer recognised built-in ones (all the referenced namespaces at the top of my controllers were underlined in red). I then deleted the .vs folder (again), which seemed to solve the problem.
When I recompiled my solution, it gave a few CS0433 compilation errors with duplicate namespaces for the MinLength and MaxLength directives in some identity user name and password validation code. I got round this by removing the Microsoft.EntityFramework Nuget library (I had to also remove Microsoft.AspNet.Identity.EntityFramework too, since this depended on it), then adding them both back in, making sure to include at least version 6.2 of the former (otherwise I got another runtime error to do with the FirstOrDefaultAsync method called somewhere!).
My current situation: all existing Intellisense is working, but it's not recognising new classes I add unless I exit Visual Studio and go back in again. May have to live with this ... unless anyone can help me?
I've got that problem today with only one project. I got no Intellisense warnings (i.e. naming styles, "Variable not referenced", etc..) for files in that project. Not in VS 2017 Pro nor in VS 2019 Community.
Check, if your Project->Build->"Warning level" is set to 0...
If you have Visual Studio 2017 installed side-by-side with Visual Studio 2019, close VS2019, open the project in VS2017, wait until it is fully loaded, then close VS2017, and reopen VS2019 - fixed!
There must be a bug in the VS2019 intellisense stuff, but VS2017 seems to fix it with no need to keep deleting the .vs directory.

Project in VS2010 unavailable and can't reload

I've been trying to load a project from a SourceGear Vault Client that has a plug-in for Visual Studio 2010. After selecting the solution file, the solution explorer populates with the associated projects but appends (unavailable) to the end of each project name.
The usual remedy is to reload each unavailable project but in doing so briefly reveals all files within each project but then VS quickly hides them and makes the project unavailable again.
So far, I have tried opening the code in VS2015, removing all related source control information from the .csproj and .sln files, and deleting the associated .suo file. Nothing has worked yet and I have exhausted all the known fixes.
Thanks for your help.
For clarity, I'm copying #PeterRitchie solution that worked for me, below.
You could try running Visual Studio in safe mode to see if a 3rd party plugin is to blame: devenv.exe /SafeMode – Peter Ritchie

VS 2015 w/ Xamarin: This item does not support previewing

I'm using Visual Studio 2015 with Xamarin 4.1.2.18 and CocosSharp PCL 1.6.2.
When I try to access the Properties of the Android project by clicking on the "Properties" item in the Solution Explorer, this error pops up:
If I also right click on the project itself and select "Properties", it displays "This item does not support previewing".
It should be opening up to this page:
I have (supposedly) the latest build and Update 3. I have reinstalled it 3 times now.
Normal uninstaller. Reinstalled... nothing, still broken.
Uninstall again with cmd: /uninstall /force, use registry cleaners, manually uninstall components from Control Panel, manually delete folders. Reinstall... still broken.
Finally, I searched around and found this: Microsoft Visual Studio Uninstaller. After I, again, performed all the steps of 2, I used this tool and it found 52 additional things to clean up. I thought I finally had fixed it. Nope. The properties thing is still broken.
I have tried running as administrator. Nope.
I have deleted the ComponentModelCache in local AppData. Nope.
I have deleted the .suo file. Nope.
I know it has nothing to do with the project files because we have all the files synced with Git and my friend can view the properties page fine on his computer.
Does anybody know how I can fix this?
Is there some way to gather more information on the error?
Any Visual Studio error logs?
Also, on an semi-unrelated note:
When I try to build the Android project, I get errors saying that the $(TargetFrameworkVersion) for my references/dependencies is v4.2 and the $(TargetFrameworkVersion) of my project is v2.3. I checked my TargetFrameworkVersion property in the .csproj file and it's v6.0!
So, something is seriously wrong with this build of Visual Studio or something.
I've been considering just installing Visual Studio on a VM just to be sure.
Solution:
In the Android SDK manager, I had Android 4.0 (API 14) downloaded. Once I switched to Android 4.2.2 (API 17) everything started working.
I just gotta say, the error that it gave me is the most convoluted error message that I've ever received in the history of my programming career.

No symbols have been loaded for this document VS2015

I have seen several posts regarding this same issue. None have solved my problem. I have recently downloaded VS2015, I had been using VS2012. I open the same project in both, 2015 does not load the symbols and 2012 does. If I open it in 2012 and build it, then open it in 2015 it will load the symbols until I rebuild it. Anyone have any ideas?
One other thing that I thought interesting. I have a Winforms app that I did the exact same process with and the Winforms app works great
This was a bug with Telerik Data Access. They stopped supporting their visual designer. In order to fix the issue you have to get the updated Data Access from a NuGet package Telerik.DataAccess
The installation of the new data access should give you the Q2 2015 DLLs. It will also add a packages file to your project. You also need to open that and change the line
<UseXmlMapping Condition="'$(UseXmlMapping)'==''">false</UseXmlMapping>
to
<UseXmlMapping Condition="'$(UseXmlMapping)'==''">true</UseXmlMapping>
And also add the following code at the end of your property groups and before item groups
<PropertyGroup>
<UseXmlMapping>true</UseXmlMapping>
</PropertyGroup>

Visual Studio 2013, changes not showing in debug

Have recently upgraded to Visual Studio 2013 Pro and am having some teething problems.
Primarily if I change any HTML or CSS in either a .aspx page for Web Forms or .cshtml for MVC, the changes aren't always reflected on the page I'm working on when I debug it and don't appear not matter how times I refresh or clear my cache.
Am using web essentials, which should put the changes straight on the page with have to refresh the page but this doesn't seem to be working either.
Also occasionally, but not always, if I stop debugging, change the code behind then run the project again it says it's running from a different version of the code than the one being debugged and I have to stop it, rebuild and then debug.
Have never had these problems on previous version of Visual Studio.
Any suggestions?
Go to Tools-Options
Under Projects and solution -> Build and Run select "Always build" under "On Run, when projects are out of date"
I had the same issue today. I already had that setting on (Always Build). Cleaning & rebuilding the solution didn't do the trick. I looked under C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\ and I found a folder named root with a lot of temporary hexa-numeric named folders. Only one folder had today's date. I closed all VS 2013 windows and removed that folder. After I restarted VS 2013 I simply run the project and my changes are now back.
I just spent the past hour trying every answer and none of them worked. I simply cleared the cache on the browser I was using to debug (google chrome) and it updated my changes. This question had the correct answer:
visual studio not updating html / javascript to server / browser
I was experiencing old code in the debugger with a console application calling a DLL. I believe it was occurring because the previous version of the DLL was installed in the Global Assembly Cache (GAC), and the Visual Studio debugger was calling the DLL in the GAC (Which had the old code) instead of the current version. I uninstalled the DLL from the GAC and the problem was resolved.
Uninstall an assembly from the GAC (MSDN)
I had this issue and tried all the Build config changes etc without success. I'm running VS2015 in a Parallels VM and saving the project on a drive on the Mac. It appears that there is some odd/tiny difference between the Mac time stamps and the Win10 clock.
Setting the Win10 clock back 5 seconds resolved the issue. Bizarre but saved my sanity...
for my case, I tried all the before mentioned answers but nothing worked. and then I went to the system logs and found a hint about failure in loading IIsexpress for the running application. I changed the port that the application used and voila! everything is back to normal. thought this might help someone
I had a similar issue and found the solution by checking the path of the virtualDirectory for your sites that are found within your applicationhost.config file.
Typically located here:
C:\Users{your user name}\Documents\IISExpress\config
You want to make sure the physical path for both locations are the same since sometimes they get wonky when working on various branches/projects etc.
it's not a bug at all, and has nothing to do with the above answers.
Go to solution explorer and click on --> sync with active document. as shown bellow:

Categories