Visual Studio Test Explorer doesn't show results - unit-testing

Visual Studio's Test Explorer was not showing the icons that indicate whether tests passed or failed. There were additional problems.
I'd tried rebuilding the solution, reinstalling Visual Studio, as well as rebooting the machine.

I deleted the .vs directory under the solution. The files were corrupt and I could not delete through Windows Explorer. I booted into safe mode command prompt and still could not delete the files. Running chkdsk /f found and fixed a few issues. Now I was able to delete the files in the .vs directory, boot into a normal Windows session and confirm the fix worked.
I hope this helped you fix a similar problem!

Related

Visual studio compiling failed without any errors [duplicate]

I have a WebApplication which contains reference to WCF services.
While building using Visual Studio 2010, Build fails without any error or warning. However building the .csproj using MsBuild is successful.
Can't figure out what should I try in Visual Studio, to resolve / diagnose the issue. Can you please help out?
I find out that the build has been failing,
From text displayed in status Bar.
From output window:
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
The output tab includes configuration details.
------ Build started: Project: <projectName here> Configuration: Debug Any CPU
I noticed that if "Build + Intellisense" is selected in the Error List, it causes the error messages to be swallowed.
Change this option to "Build Only", and all error messages will be displayed:
I don't know if this is a bug in Visual Studio or what, but it certainly revealed hidden error messages that were the key to pinpointing the failure for me.
Some, like Richard J Foster, have suggested increasing the "MSBuild project build output verbosity" setting to "Diagnostic" (the highest possible option), but this didn't solve the problem for me, as Visual Studio appeared to be suppressing the error message(s) themselves.
As an alternative, you may try to use the raw output messages from the "Output" tab, which haven't been filtered by Visual Studio. Either do an in-place search for the strings "error" and/or "failed", or copy all of the output to your favorite text editor and do a search there.
To ensure that the Output window appears each time you do a build, you can go to Tools → Options → Projects and Solutions → General, and ensure that the option "Show Output Window when build starts" is checked.
As an additional troubleshooting step, it is also possible to build the project from the PowerShell command line by running dotnet build. This will show you the complete build output, including any errors that Visual Studio may be hiding.
I just ran into a similar situation. In my case, a custom action (from the MSBuildVersioning package available on Nuget.org - http://www.nuget.org/packages/MSBuildVersioning/) which appeared in the csproj file's BeforeBuild target was failing without triggering any error message in the normal place.
I was able to determine this by setting the "MSBuild project build output verbosity" (in the latest Visual Studio's Tools tab [Path: Tools > Options > Build and Run]) to "Diagnostic" as shown below. This then showed that the custom action (in my case HgVersionFile) was what had failed.
Here are some things that you can try:
If your solution contains more than one project, try building each project one at a time. (You may even want to try opening each project independently of the solution.)
If applicable, ensure that all of your projects (including dependencies and tests) target the same version of the .NET Framework. (Thanks to user764754 for this suggestion!)
Tip: Check Tools → Extension and Updates to ensure that your packages are up-to-date.
Ensure that all dependency projects are built to target the same platform as your main project.
Try restarting Visual Studio.
As suggested by Bill Yang, try running Visual Studio as Administrator, if you aren't already. (If you are already running Visual Studio as Administrator, perhaps try the opposite?)
Try restarting your computer.
Try "Rebuild All".
Run "Clean Solution", then remove your *vspscc* and *vssscc* files, restart Visual Studio, and then "Rebuild All".
As suggested by Andy, close Visual Studio, delete the .suo file, and restart Visual Studio.
As suggested by Arun Prasad E S, close Visual Studio, delete the .vs folder in your solution directory, and then re-open Visual Studio. (This folder is auto-generated by Visual Studio and contains cache, configuration settings, and more. More details can be found in these questions: Visual Studio - Deleting .vs folder and https://stackoverflow.com/q/48897191.)
As suggested by MrMalith, close Visual Studio, delete the obj folder in your solution directory, clear your temporary folder, and then re-open Visual Studio.
Delete the hidden .vs folder & restart Visual Studio. That worked for me.
I want to expand on Sasse's answer. I had to target the correct version of .NET to resolve the problem.
One project was giving me an error:
"The type or namespace name 'SomeNamespace' does not exist in the namespace 'BeforeSomeNamespace' (are you missing an assembly reference?)".
There was no error in the Error List window but the assembly had a yellow warning sign under "References".
I then saw that the referencing project targeted 4.5.1 and the referenced project 4.6.1. Changing 4.6.1 to 4.5.1 allowed the overall build to succeed.
Nothing was working for me so I deleted the .suo file, restarted VS, cleaned the projected, and then the build would work.
I tried many things like restarting Visual Studio, cleaning and rebuilding the solution, restarting the PC, etc., but none of them worked for me. I was finally able to solve the problem by doing the following:
First of all, make sure all the projects in your solution (including tests) are targeting the same .NET version. Then:
Save pending changes in the project and close Visual Studio
Find the exact location from file explorer and find "obj" file and open it,
Then, delete all the included files (some files won't remove, it doesn't matter, just skip them).
Use run command (by pressing Windows Key + R) and type "%temp%" and press enter to find temporary files.
Finally, delete them all.
On other possibility is that Visual Studio needs to run as Administrator, this might be related to deploying to local IIS server or other deployment need.
Just for the sake of completion and maybe helping someone encountering the same error again in the future, I was using Mahapps metro interface and changed the XAML of one window, but forgot to change the partial class in the code-behind. In that case, the build failed without an error or warning, and I was able to find it out by increasing the verbosity of the output from the settings:
In my case (VS 2019 v16.11.20), disabling Text Editor->C#->Advanced->Enable 'pull' diagnostics in the options solved the issue.
Double check for _underscore.aspx pages in your project.
I had a page and code-behind:
`myPage.aspx` and `myPage.aspx.vb`
when building the project, I'd get errors on the .aspx.vb page stating that properties defined on the .aspx page didn't exist, even though the page itself would build fine and there were NO OTHER ERRORS showing in the output (even with diagnostic level build output).
I then came across a page in the project that was named the same thing but with an underscore: _myPage.aspx - not sure where it came from, I deleted it, and the solution built fine.

Unable to update visual studio installer

Wanted to add this question to the pool in case someone has the same problem
I was unable to update Visual Studio 2017 on Windows 7 and got the following error:
Unable to install the files to target location. Error: The folder
'c:\Program Files (x86)\Microsoft Visual Studio\Installer' or a file
within it is locked by another program. Close any applications that
might be using it and try again.
The initial solution I found was to reinstall Visual Studio but felt that it might be unnecessary. The solution I found was to close down visual studio, go to "c:\Program Files (x86)\Microsoft Visual Studio\Installer", rename the folder "Installer" to something else then run vs_installer.exe from the renamed folder.
Hope that help someone.
I just recently encountered the same error while trying to update the Visual Studio 2017 installer on Windows 10. In my case, the c:\Program Files (x86)\Microsoft Visual Studio\Installer directory was locked because of virus/malware scanning software running in the background. After stopping that, the installation of the VS 2017 installer had no more problems.
What initially misled me about the source of the problem was that the process which had a lock on the files in that directory was the special System process in Process Explorer, so I was initially going down the wrong rabbit hole.
If you have malwarebytes then you can add to the allow list C:\Program Files(x86)\Microsoft Visual Studio and it will work.
I got it working by downloading the installer separately, rebooting, and running the installer directly.
VS Installer Downloads
I encountered this when trying to update VS2019. I could not rename the Installer folder. Rebooting didn't help. I tried uninstalling everything related to Visual Studio via Control Panel, but the uninstall failed. It removed everything except a subfolder containing VSIXAutoUpdate.exe and some dlls. The installer still would not run.
This final step allowed me to delete the Installer folder and do a fresh install of Visual Studio.
Open Task Manager > Processes Tab
End Process "VSIXAutoUpdate"
Delete folder "C:\Program Files (x86)\Microsoft Visual Studio\Installer"
TL;DR
Stop the Task Scheduler service and ensure no open handles for the C:\Program Files (x86)\Microsoft Visual Studio\Installer dir
Details
I just had the same problem, and even rebooting didn't help. So, I dug in!
Process Hacker revealed there was a lock on the following file by the System process:
C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXConfigurationUpdater.exe.
If I used Process Hacker to close the handle, it just immediately reopened again :/
I thought to check Task Scheduler (since it runs as SYSTEM in svchost), and sure enough there were tasks in there that run VSIXConfigurationUpdater.exe, even though they weren't actually running at that time.
So I stopped the Task Scheduler service, then used Process Hacker to close the handle on VSIXConfigurationUpdater.exe - and this time it didn't return! After ensuring there were no open handles on anything inC:\Program Files (x86)\Microsoft Visual Studio\Installer, the Visual Studio installer was able to update.
I found the culprit for me was Malwarebytes disabled this and all worked well. Hope this helps somebody.
I tried to run through the steps #Janspeed specified, but there were a couple of language folders in the resources directory that were corrupted/locked, so just renaming wouldn't work. I managed to copy most of the file/dir structure (minus the corrupted ones) to a new directory but had to run a chkdsk /f on a restart before I could get those folders freed up and deleted. Once I had this worked out, #Janspeed's steps worked fine, including just deleting the new directory that I had copied everything into.
I ran into this issue today, turns out it was MalwareBytes Endpoint Protection that was blocking the update which is rather annoying.
Luckily I'm the admin and developer so I was able to drop my laptop from the antivirus to enable the update and then re-add it but in a larger corporate environment with red tape this isn't great at all.
I had faced the same issue while updating Visual Studio 2017 and 2019. I tried to open the Visual Studio Installer directly as admin and then it worked as expecred.
Update kept failing when using the "Check for Updates" menu item in the VS2019 IDE. When I ran the Visual Studio Installer from the Windows Start bar it immediately prompted to download the latest version of the installer. Once that was done it then offered to update VS2019.

Unable to start VS2012 Profiler

I'm trying to start a performance profiling session in Visual Studio 2012 RTM on Windows 8 PRO 64-bit for a console program (ANALYZE / Start Performance Analysis).
I get a popup message informing me
Could not load file or assembly 'Microsoft.VisualStudio.PerformanceTools.CounterInfo.dll' or one of its dependencies. The Specified module could not be found.
Apparently this can happen under VS2010 after KB2645410 is installed. I carefully followed the procedure given for this issue with the same error message:
Visual Studio 2010 SP1, KB2645410 and Add-Ins
However, that does not resolve the issue.
I have tried running VS2012 as Administrator as well.
How can I get the profiler working?
UPDATE
I can actually attach to a running instance of the project from the command line using the steps here:
Walkthrough: Command-Line Profiling Using Sampling
However, Visual Studio does not open the resulting .vspx file (it just does nothing after I open it with File / Open File).
UPDATE 2
Fuslogvw reports two binding errors when I attempt to start the profiler:
VS 2012 Profiler Binding Errors - Pastebin
Adding the following to the system path resolved the issue for me permanently.
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools
Some other answers may be appropriate to other situations.
Note that you probably will need to run Visual Studio as Administrator for profiling to work correctly.
I also struggled with that issue.
I found a working solution for me:
I opende the XXX.sln file using notepad.
There i found several parts in the Project and Global Section looking something like this:
ProjectSection(SolutionItems) = preProject
Performance1.psess = Performance1.psess
EndProjectSection
I removed all of them and that made my Analyzer work again.
I delete the .suo file and everythings works correctly now.
The same question exists here:
http://social.msdn.microsoft.com/Forums/en-US/a6487155-980c-4bc8-82de-2fe588fdf37f/windows-update-kb2645410-and-performance-tools-error
The following are suggested workarounds:
Remove windows update KB2645410
Only run one instance of Visual Studio
If you are the administrator on your development PC you can add the permission to Everyone to read and execute all the content in the folder "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools" and subfolders/files.
"I backed everything up and did a complete repair of Visual Studio using the original disk from Microsoft. That allowed the computer to shut down normally. Then I tried the patch again. It hung again, but after a few reboots we got a message about deleting corrupt files and finally everything seems OK."
My issue was resolved when I realized that my user access control was set too high. Once that was turned off, I rebooted and it all worked great.
Once I uninstalled re-sharper my issue was resolved.

Visual Studio 2010 crashes at successful build

Upon building my C++ projects vs2010 crashes even though the process was successful, I tried updating to Sp1 to see if that would fix the problem. But was stopped by some errors on installation. I tried to re-install, safemode, I had some addins about 3, AnkHSVN and two basic other and deleted them but experienced the same problem.
Specs:
OS: windows 7 64
VS: 2010 U
Found a solution.
To fix: click start, type "cmd" into the search box, right click "cmd.exe" in the search results, select "run as admin", then run this command: regsvr32 "C:\Program Files (x86)\Internet Explorer\ieproxy.dll"
Reference: http://connect.microsoft.com/VisualStudio/feedback/details/533194/crash-while-compile-an-extremely-simple-c-project
If that doesn't work, AnkHSVN is known to cause the same problem. You said you uninstalled it, but you may want to check out this page: http://blogs.msdn.com/b/visualstudio/archive/2010/05/11/if-you-are-seeing-intermittent-crashes-with-vs-2010.aspx
As a test, get out of visual studio. Rename the .suo file in your solution directory. Go back into visual studio and rebuild all.

Intellisense auto-complete is causing VC++ in Visual Studio 2005 SP1 to crash

UPDATE1: I have reinstalled Visual Studio and I am still having this problem. My guess is there is a problem with my environment.
Update2: Diving in.
I attached windbg to devenv and set a breakpoint in windbg for msenv!_tailMerge_WINMM_dll and traced through.
This is trying to load winmm.dll using the LoadLibrary API. I can see that LoadLibrary is failing and GetLastError is returning 5 which is "access denied".
now, why would vs be denied access to winmm.dll?
---Begin Original---
I am currently having a serious issue with Visual Studio 2005 SP1 Intellisense in C++. I have an all native solution with on project. Whenever I, or the editor, attempt to invoke intellisense auto-complete pow, Visual Studio crashes. I even tried this with a brand new console app. Ctrl + Space in the empty main and Visual Studio crashes.
I googled for help on this but to no avail. I have tried deleting the ncb file but no luck on that front either.
I am currently working with Intellisense turned off as shown in this article:
Visual Studio 2005 - 'Updating IntelliSense' hang-up
And I have no crashes, but it sure would be nice to have intellisense back
Call stack from a crash dump.
7c812a6b kernel32!RaiseException+0x53
502717a6 msenv!__delayLoadHelper2+0x139
50675186 msenv!_tailMerge_WINMM_dll+0xd
505ac3c3 msenv!CTextViewIntellisenseHost::UpdateCompletionStatus+0x1a7
505acb50 msenv!CEditView::UpdateCompletionStatus+0x30
505dcfad msenv!CEditView::CViewInterfaceWrapper::UpdateCompletionStatus+0x2a
02ae47fc vcpkg!CCompletionList::DoCompletion+0x444
02ade2ce vcpkg!CAutoComplete::PostProcess+0x240
02ade07f vcpkg!CAutoComplete::OnACParseDone+0x3e
02adac2d vcpkg!CMemberListWorkItem::OnCompleted+0x9d
029eb4e3 vcpkg!CWorkItem::ProcessPendingWorkItemCompletedCalls+0x117
029f8b4f vcpkg!CParserManager::OnIdle+0x183
0299961a vcpkg!CVCPackage::OnIdle+0x48
5014b288 msenv!ATL::CComAggObject<CTextBuffer>::QueryInterface+0x43
5a9d2394 VCProject!ATL::CComPtr<IOleInPlaceFrame>::~CComPtr<IOleInPlaceFrame>+0x24
5a9d2880 VCProject!ATL::CComObject<CVCArchy>::Release+0x10
774fd420 ole32!CRetailMalloc_GetSize+0x21
5009422b msenv!CMsoCMHandler::FContinueIdle+0x23
5009422b msenv!CMsoCMHandler::FContinueIdle+0x23
I would try the following set of steps to try and fix the problem
Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings
Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart VS
Repair the VS installation through Add Remove Programs
Disable all 3rd party plugins
Did you try repairing the Visual C++ installation?
Do you have any plugins installed? Try disabling them.
It might be worth it to delete the .ncb file in the project directory, in case it was corrupted (.ncb is the intellisense database file).
If you're doing C++ development for a living (or at least doing serious development), there's no reason not to use Visual Assist.
What a bizarre problem.
I finally figured it out using procmon from sysinternals:
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
My sounds were somehow changed to windows default sounds after a recent trip to IT. This caused visual studio to play a clicking sound when intellisense happens. In order to play this sound winmm.dll must be loaded up, which is located c:\windows\system32\winmm.dll.
I suppose through debugging foray winmm.dll symbols were downloaded to a FOLDER called C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\winmm.dll. Of course this folder looked mighty tasty to Visual Studio, so when it tried to load the winmm.dll folder as a dll file POW!!!
I deleted the folder, and some other .dll folders :) and all is well.
Thanks for your help.
Make sure you are up on your service packs, I think VS 2005 is at SP1.
Try "cleaning" the solution, i.e. delete (rename) all temporary files like *.ncb, *.suo etc that have been created by Visual Studio. One of these files might have got corrupted (Your problem sounds like the IntelliSense database is broken).