Issue with running Unit Test in Visual Studio 2012 - c#

I am getting the following error while building unit-test.
Error: "IUnitTestStorage.Open should be called before operation can continue."
I have never got this error before and all was working fine before this moment.
I have tried deleting all bin and obj files and rebuillding, it didn't help. Moreover, when I created new unit-test project (with no code of mine) and it gives the same error.
Closing all Visual Studio instances and starting them back didn't help as well.
I am using Visual Studio 2012 Premium Update 4.

I just closed and re-opened VS2015 and cleaned solution and it worked for me

I got it today in Visual Studio 2015. Just delete all in debug folder, release folder and all in obj folder.
Build the solution then it works out.

According to this it helps to clean and rebuild solution, not just build. I know it's little bit silly but in case you haven't tried it...

It's an issue with Updated version of Telerik Test Studio. Try Re-installing Telerik Test Studio to Resolve this. It works for me.

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.

C# project won't compile anymore due to missing reference to Microsoft.Office.Tools.Common.4.0.Utilities

It used to compile just fine but as of today it won't anymore - I'm using Visual Studio 2019 and I tried installing the Visual Studio Tools for Office Runtime 2010 and closing/reopening the project but that didn't help...
Try to delete the .vs, the bin and the obj folders of your project. Open your project again and rebuilt it. This steps will most likely resolve your problem.
I installed the Office development workload from the Visual Studio installer and that resolved the reference for me. No idea how it was working before...

"Predefined type 'System.*' is not defined or imported" Error, visual studio code, omnisharp

I'm having an issue with the mentioned error in several .net core applications. I'm using vs code version 1.18.0 but the error started to appear already in the previous version.
The error appears in every .cs file for every datatype like string, int, void etc. and also for class imports.
All the projects still compile and run properly. Also on another workstation I'm not having the issue in the same projects, so it seems to be a local omnisharp/ vs code or windows? problem.
Has anyone had something like this and managed to fix it or any suggestions on what i could try?
I've reinstalled vs code and omnisharp already, but I'm still having the problem.
example Error:
Predefined type 'System.Object' is not defined or imported [GG]
I found a fix ( or workaround) for my problem:
short version: I changed the omnisharp msbuild instance by uninstalling Visual Studio 2017 Pro.
long version: A few months ago I installed VS 2017 Pro to check out the features, used it for 2 weeks in trial mode and forgot about it for several months.
Around one week ago I opened it (by accident :D) and got a notification, that my trial period expired, also VS locked itself.
It didn't bother me , because I wasn't using it. In #VahidN 's Link I found out that omnisharp is using "the most native" msbuild instance that is installed, which in my case was the one of the locked VS 2017 Pro. 1+1 I unsinstalled VS and I'm good.
I'll reinstall VS 2017 ( Comunity) and post a comment if it still works fine.
EDIT:: I reinstalled VS 2017, everything works fine, so the actual solution is updating VS 2017, which i couldnt do besause it was locked prieviously.
Thanks for sharing your fix. Unfortunately, that didn't work for me. What worked for me is to reinstall the latest OmniSharp.
Copy-pasted from this ticket:
The fix for this has been pushed into OmniSharp. You should be able to get the fix by setting the "omnisharp.path" option in VS Code to "latest". That will cause C# for VS Code to download the latest build OmniSharp at start up.

How to build phpalanger phpc?

I've tried to build https://github.com/DEVSENSE/Phalanger, but after the build process it shows build errors. I tried VS 2015, maybe there it just a question of a wrong version?
It is outdated project, unload the Tests projects for now.
It is not the version of studio, see https://github.com/DEVSENSE/Phalanger/blob/master/Solutions/Phalanger.sln it says Studio 14 which is VS 2015.
Would be worth checking the readme, see https://github.com/DEVSENSE/Phalanger/tree/master/Source but this looks more like an issue in the code to me.

Install Sheild LE -4340 Internal Build Error Visual Studio 2012

I have an issue with building an MSI with Install Shield LE in Visual Studio. The error says "-4340: Internal Build Error", but the link to Flexera is worthless. I tried the suggestion in another post to add the installer project to a fresh solution and then my .Net projects after, but that did not help. That suggestion can be found here.
I have not found a single repeatable cause of the issue, it does not seem to happen because of any one thing. I'm trying to build an installer for a Windows Service.
I got that error too. In order to fix it i rebuild my solution in Release configuration instead of Debug one.
All I did is restart Visual Studio. For some reason that worked for me.
My solution is slightly different:
Close and launch Visual Studio, open solution then
Rebuild with Release configuration AND
Unload/load InstallShield
Setup:
Visual Studio 2015, Windows 10, Visual C#
When I had this error, it was because I added an executable for extra dialogs to be run after the install. I told install shield to run the executable, but I didn't add it to the list of files to deploy.
When I added it to the files, the error went away.
It could be that when users switch to "debug" that they have a build of the executable in debug mode, but they never built it in release mode.
It would be nice if flexera produced a normal error message for my case at least. i.e. "You said to run XYZ, but XYZ is not found in the file list"
I had the same issue and solved it by deleting a previous build. It looks like Visual Studio wasn't able to delete the previous version.
I am quite late to this post... but I will post the solution in case others run into the problem. I worked with Flexera on this problem and they provided a fix for it. Download and install IS 2016 SP1 or newer and the problem is solved! Read all about it at
https://community.flexerasoftware.com/showthread.php?220123-ISDEV-error-4340-Internal-build-error&p=509912
I just had this again for the x-thousandth time. Normally the rebuild approach works, or failing that restarting VS, but this time I actually had to restart Windows to get it working again. Hope that helps someone, I was starting to really think it wasn't going to work again this time.
I had to unload/reload the InstallShield project in order for it to build.
I'm getting this error when I forget to start Visual Studio with Administrator privileges.

Categories