Continue to Show This Error Message Visual Studio
Visual Studio errors can be very annoying. Right?
Sometimes we spend hours or even days troubleshooting problems.. Ugh!
So I've compiled a post on the most common Visual Studio errors that my students and I encountered. I will maintain and update this post over time.
I also supplied information on how to fix these errors.
Hope it helps…
[toc]
Visual Studio Error
The command "chmod + x" exited with code 9009
Error Message
The command "chmod + x" exited with code 9009
The Problem
Problem A:
The problem is that probably occurs when you are trying to build a solution. At that point, in your console, you get this error.
This stems from the fact that you have a space somewhere in your folder structure. For example:
"C:SourceGithubFolder With Space"
Problem B:
In this case, your folder structure may be fine. However, you might find a project that for some reason didn't pull all of its dependencies from Nuget.
If you look at the solution, under References, you'll see errors on a bunch of the Nuget packages.
The Solution
To Problem A:
Simply rename your folder or file so that it doesn't have a space in it. For example, change the above to:
"C:SourceGithubFolderWithSpace"
Your solution will now build correctly
I fixed "The command "chmod + x" exited with code 9009 error." Thanks to this post! https://ultimateqa.com/?p=8810 Click To Tweet
To Problem B:
- Right click on whole solution
- Click Restore Nuget Packages
- Rebuild solution
I fixed "The command "chmod + x" exited with code 9009 error." Thanks to this post! https://ultimateqa.com/?p=8810 Click To Tweet
A project with an output Type of class library cannot be started directly
Error Message
A project with an output Type of class library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.
The Problem
The problem is that you create a project as a type "Class Library" or "Unit Test Project" and are attempting to execute this project using the key F5, which means "Run". You cannot run these types of projects in this manner. A unit test project must be executed using the Test Explorer of Visual Studio.
The Solution
Option 1
In your IDE, go to Test > Windows > Test Explorer. This will open up the Test Explorer. Right click the name of your unit test and then select "Run Selected Tests".
Option 2
Place the cursor inside of your test method. Press Ctrl + R, T. This will run the test that has the cursor.
This free C# course will teach you how to correctly run the different kinds of projects.
Program does not contain a static 'Main' method suitable for an entry point
Error Message
Program does not contain a static 'Main' method suitable for an entry point
The Solution
Same solution as this error "A project with an output Type of class library cannot be started directly"
The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found…
Error Message
error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
The Problem
The problem is that you need to install the correct version of .NET Framework to open this solution.
The Solution
- Follow the instructions here to get to the Modify screen of Visual Studio
- You might be prompted to update VS Installer, go ahead and do so
- In the Installation Details pane on the right hand side, make sure that you select all of the .NET Framework and .NET Core installations. That way, your environment can support all current .NET implementations.
- Click the Modify button
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Error Message
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Visual Studio, MsTest
The Solution
In Visual Studio go to Tools > Options > Debugging > uncheck "Enable Just My Code"
Unit tests not running in Visual Studio Test Explorer
Error message
UTA031: class … does not have valid TestContext property. TestContext must be of type TestContext, must be non-static, public and must not be read-only. For example: public TestContext TestContext.
The solution
If you are using the MStest unit testing framework, make sure that your TestContext property follows the specifications listed in the message. Meaningnon-static, public and must not be read-only.
It should look like this:
public TestContext TestContext { get; set; }
Unit tests not showing up in Visual Studio test explorer
Error Message
Something like this below:
…\MSTest.TestAdapter.1.2.0/build/_common/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
The Problem
- Visual Studio Version: 15.0.X
- MSTest Adapter version: 1.18
There seems to a be bug with Visual Studio and the Visual Studio test adapter when you are trying to work with the versions listed above.
The Solution
To fix this problem, you need to update Visual Studio to version 15.5.2 and your MSTest Adapter in the Nuget package manager to version 1.2.0.
Are your unit tests not showing up in the Visual Studio Test Explorer? Here is the fix https://wp.me/p7absY-4E #automation #development #programming #dotnet Click To Tweet
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly…
Error
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
The Problem
There seems to be some issue with .NET Core apps that you can learn more about here. Only if you want to read about it.
The solution
The solution I got from that post I mentioned. However, you basically just need to do this on your .NET Core project:
Install Nuget package for System.Configuration.ConfigurationManager
That should do it đŸ™‚
An exception occurred while invoking executor 'executor://mstestadapter/v2' …
Error Message
This message is in your Output pane in "Output from Tests".
An exception occurred while invoking executor 'executor://mstestadapter/v2': Constructor on type 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner' not found.
The Symptoms
You are trying to run your Automation tests using MSTest, but they don't run. They start going, but then Visual Studio just stops. When you check the Output pane, you see the message described above.
MSTest has a bug and needs an update. I had version 1.1.11 installed and it caused me this issue.
The Solution
- Using NuGet Package manager, update your MSTest.TestAdapter and MSTest.TestFramework NuGet packages to the latest version. I updated to 1.1.18.
- Restart Visual Studio
- Re-run your automation tests
An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests…
Error Message
An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine'
The Problem
A caching issue with NUnit
The Solution
In this bug to NUnit, lorenh provides the solution about how to delete your cache.
An exception occurred
System.SecurityExceptions (multiple options)
Error Message
Almost any error message that contains SecurityException or something being "Inaccessible"
Here is a specific example that deals with NLog:
Error Error initializing target 'EventLog Target[eventlog_wrapped]'. Exception: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate)
at System.Diagnostics.EventLog._InternalLogNameFromSourceName(String source, String machineName)
at System.Diagnostics.EventLog.LogNameFromSourceName(String source, String machineName)
at NLog.Targets.EventLogTarget.InitializeTarget()
at NLog.Targets.Target.Initialize(LoggingConfiguration configuration)
The Zone of the assembly that failed was:
MyComputer
The Problem
It's stupid if you ask me, but a certainly recurring problem…
For whatever reason, Visual Studio sometimes requires you to start it as an Administrator. I believe this is after first installation or any kind of modification to Visual Studio.
The Solution
- Right click your Visual Studio icon
- Select "Run as administrator"
- Perform whatever operation you were previously trying to perform.
- The error should now be fixed
PS. You don't need to keep running it as Administrator after this. At least it's a one time action.
Summary
Hope this was helpful?
Is there an error that you need help resolving? Please comment below and I'll try to resolve it for you.
Source: https://ultimateqa.com/visual-studio-error/
0 Response to "Continue to Show This Error Message Visual Studio"
Enregistrer un commentaire