how do i do that: Visual Studio shows no error description - c#

first of all i dont know what the title error wants from me therefore its this strange title for the problem xD
If I purposely mistype "Count" into "cont", I have an Error or Suggestion from VS that doesn't show any description.
But if i press the 'play' button i can see the error Description in the error window.
I have reinstalled VS and checked all Variables in Unity.
I have no idea whats the problem and i dont know what to search for. Cause the intellisense system works and it shows that there is an error at the line but not the error description :/
Red
(What did you try and what were you expecting?)
i dont know what to write here?! i say everything in the other input box

From your description, after re-install VS the issue still exists, so the issue should come from the project level cache/settings instead of VS environment file lacking.
You can try to create a new project and writing your code as the simplest like this:
using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
List<Upgrade> upgrades = new List<Upgrade>();
var xxx = upgrades.cont;
}
}
class Upgrade
{
}
}
If the issue disappears in the new project, I suggest you delete '.vs' directory, '.vs' directory stores settings and caches, it will be created when you open the solution at the first time. This directory is under the same folder level of .sln file. After deleting it, when you open the solution next time, this directory will be re-generated. Intellisense caches are in this directory, that's why we suggest you to re-generate it.
If the issue doesn't disappear in the new project, please check your VS version, if it is not the lastest, please update it to the latest version.

Related

ASP.Net Core: Hundreds of Build Errors Suddenly

What might cause an ASP.Net Core web application to display hundreds of build errors suddenly without explanation? I started working on an app I had not worked on for awhile and when I clicked publish I got hundreds of build errors that never existed before.
Some were quite simple. Like this block of code used for a Blazor component (file extention .razor) that never had problems before. This block displays red squiggly lined underneath both instances of the string "crumbicon" I can think of no reason why there would be a problem with this:
#using PostAlmostAnything.Models
#crumbiconHome
#code {
string crumbicon = "<<";
}
The exact errors say that there is "ambiguity between filename.crumbicon and filename.crumbicon "the type [blazor file name] already contains a definition for crumbicon". This error has never been encountered before, but now exists on every .razor file that was designed this way.
The other error appear related to various assemblies or variables on pages. They typically say that something has already been defined someplace else, but if the code were the problem then it would have been an error long ago and not suddenly.
When I try to update Nuget packages they say the updates are not compatible with version 3.1 of .Net Core.
Try to close Visual Studio and reopen. That always works for me to get the libraries back
Short version: jiggle it until it works.
This happens a lot. I think it's a conflict between an old assembly that didn't get cleared out of Intellisense and a new one or something like that. You can try any / some of:
clean and rebuild
close all open files and re-open them
just ignore the errors and run the app
delete the bin folder from your project
restart Visual Studio
go get yourself a coffee and wait for Visual Studio to figure it out
on its own
Visual Studio is never stable nowadays.
Try cleaning and rebuilding or cleaning obj and bin directories. this may help too
Of course, try the other suggestions mentioned in the other great answers here.
Another option is to comment out the offending lines that are giving you problems, then rebuild. Keep commenting/building until it works. Once it builds and starts again, uncomment sections one at a time until you are back up and running.
As an extra bonus you may find an errant "}" or missing tag that helped cause the issue in the first place.

Visual Studio 2017 error Cannot open "X" for writing - access to path is denied

I'm sorry I cannot seem to fix this error:
Severity Code Description Project File Line Suppression State
Error CS2012 Cannot open
'C:\Users\Usuario\source\repos\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe'
for writing -- 'Access to the path
'C:\Users\Usuario\source\repos\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe'
is
denied.' WindowsFormsApp1 C:\Users\Usuario\source\repos\WindowsFormsApp1\WindowsFormsApp1\CSC 1 Active
I suppose it has something to do with the file being read only? I tried changing it and it reverts to read only, I tried closing and reopening VS, I tried running it as an administrator, I changed the assembly name and default namespace and now it won't even run the debugger
I'm new to C#, I used to do Java and never had an error like this one, sorry if it's something very simple. By the way I'm using Windows 10 with Bitdefender installed
Had the same problem and fixed it with deleting obj directory.
Hope it helps :)
This issue occurs because the dll file is open some where, suppose you try to delete the dll file from obj folder then also message appears that "The file is open in another program."
In my case, I close all VS instance and copy the root folder and paste it into another folder then open my solution in VS it works fine.
I have ran into this issue on a few occasions. It seems the best way to fix this is to close down everything and restart your computer. It seems there is a lock on a file within the bin folder of the project and the best/only way I found so far to get around this issue is to restart your computer.
I could solve this restoring the .exe from the Quarantine zone in the Avira Antivirus, restarting the computer and turning off the real time protection in Avira, after these steps I could compile the project again.

C# EnvDTE and TFS massive problems

I have created a vsix plugin for VS 2015 that receives some data of a REST-Service, writes it into a file and then it adds the file to my C# Project.
Well the problem is that after the files were written on the file system and integrated to the project my user input in visual studio is blocked:
e.g. I can write for example "asdf" in a code file, but when I try to delete the text with the backspace button it is not working. Other buttons like CTRL are also not working.
The interesting part is when I close VS2015 the following error appears:
The problem is definitly caused by this line:
project.ProjectItems.AddFromFile(filePath);
project is an EnvDTE.Project object! The thing is the files were added to my project but I have to kill and restart VS to continue with my work.
I have also found a little workaround: When I disable TFS in my project all is working fine!
So my conclusion is that the problem is caused by TFS!
Can anybody tell me what I can do, to solve this problem! It costs me a ton of time to restart VS every time!
When using TFS, you need to checkout the project for modification first, use SourceControl.CheckoutItem: https://msdn.microsoft.com/en-us/library/envdte.sourcecontrol.checkoutitem.aspx
The problem here is not what you are doing, but how. Some modal window you are opening it's been locked to the screen. Make sure you closed it correctly.
This behavior it's common when using modal. Try to figure it out what window you are opening and try change it from modal to not-modal.
It will stop this problem.

Why is my MonoDroid/Xamarin.Android project suddenly giving me a "'java' exited with code 1." error?

While working on my MonoDroid/Xamarin.Android app, it suddenly stopped building, telling me
"java" exited with code 1.
After turning on normal MSBuild output verbosity, it showed that the error occurred in Xamarin.Android.Common.targets, located in C:\Program Files (x86)\MSBuild\Xamarin\Android. The line (line 988) starts this block of xml:
<CompileToDalvik
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
JavaOptions="$(JavaOptions)"
AndroidSdkDirectory="$(_AndroidSdkDirectory)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
JavaSdkDirectory="$(_JavaSdkDirectory)"
MonoPlatformJarPath="$(MonoPlatformJarPath)"
JavaSourceFiles="#(AndroidJavaSource)"
JavaLibraries="#(AndroidJavaLibrary)"
LibraryProjectJars="$(IntermediateOutputPath)__library_projects__\*.jar"
UseDx="$(UseDx)"
/>
Also, when I have the above file open, I have 53 warnings, all similar to:
The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'ResolveReferencesDependsOn' in namespace
'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, AllowUnsafeBlocks, ... [followed by a long list of elements]
I deleted all the code that I had recently added, then ended up doing a full revert to previous code that worked, but the error continues no matter what I do. I found a resolved bug that may occur on the same line, but the solution given there didn't work for me. Also, because of the warnings and the fact that my code used to work it its current revision, it doesn't seem to be the same problem. Any ideas why this would happen, and how I might fix it?
More details: I tried running a new M4A project and it worked fine, so it looks like it isn't a problem with the M4A file, but something my code.
Even more details: I was going through each class, commenting them out to see if I could find a particular block that was causing the problem, when the error suddenly changed. It now displays an error identical to the one found in this question. I am also using the 30-day trial. However, I am using Visual Studio. I'll be seeing if the answer and comments there will help me too.
I had the same problem and solved it by deleting my entire solution an pulling it from source control again. If you do not have a source to pull from, then i suggest deleting all generated files such as the contents of bin and debug folders.
Yes It's a good solution I have removed same problem from my project.
Step that you have need
1. Delete Bin and obj folder from project
2. Delete Solution File From Project Folder
3. Open New Visual Studio and then Click File > Open > Project/Solution >
Select Folder Where placed you project.
and after all, Rebuild Solution file and then rebuild your project.
I am sure u will success about this problem.....
I encountered this problem on a colleague's computer. The problem ended up being that his old sdk was installed under Program Files, while the update installed it under AppData. Changing this folder under Options > Xamarin > Android in Visual Studio solved the problem for him.
I have solved by disabling the Proguard option and able to build it.
Right Click on Project -> Click Properties -> Android Options -> Uncheck Checkbox of Enable Proguard.

File 'PATH\bin\Release\APPNAME\Controls\xyz.xaml' could not be found

I created a new class library for windows store apps and within this library I created a Usercontrol in a folder named 'Controls'.
I use this class library in another project (especially this controls mentioned above) and everytime I try to run this project a weird error occurs:
"Payload file 'C:\PATH TO CLASSLIBRARY FOLDER\bin\Release\LIBRARYNAME\Controls\Usercontrol.xaml' could not be found"
So I opened my library's folder and looked up this path.
The path described in the error message does not exists but if you would replace
\bin\Release\LIBRARYNAME\Controls\Usercontrol.xaml with \bin\Release\Controls\Usercontrol.xaml then there is the wanted file.
Then I simply copied the \Controls\ folder containing Usercontrol.xaml and pasted it into the newly created folder \LIBRARYNAME\Controls\Usercontrol.xaml.
Now this error doesn't occur anymore but I don't want to do this copy-paste action everytime I modify Usercontrol.xaml?!
Does anybody know why this happens? Is there a way to avoid my inconvenient solution?
Thanks for help! :)
After doing some further researching with the exacty english error message (worked with german vs2012 by then) it seems that this is a bug in Visual Studio.
More info about this:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/51111470-8a86-44d4-acb8-e268afa7564e/

Categories