I'm facing problems with unit tests. I wrote some tests which worked fine and yielded the expected results. Then I wrote a test which loads a TXT file:
[TestMethod] public void TestLoadStopwords() { string[] expected = new[] { "the", "a", "on", "off" }; string[] stopwords = Program.LoadStopwords(); Assert.AreEqual(expected, stopwords); }
This is the called method:
public static string[] LoadStopwords() { return File.ReadAllLines("stopwords.txt"); }
Since then all my unit tests fail to complete. They start but after a very short time they stop. All titles in the Test Explorer are grey and in every line is the blue rhomb with the white exclamation mark.
What I did so far:
- I needed to install the NuGet package Microsoft.VisualStudio.TestPlatform because I got an error like "cannot find Microsoft.VisualStudio.TestPlatform.TestFramework.resources".
- I think after that step all tests except the above still where able to run. The above throw an exception like that hinted that the system tried to load symbols or step into code not available on my system but in mscorlib
- I searched some forums that stated I should enable "Debugging" -> "Just my code" and or set up a local symbol cache but to no avail.
What else must I do or install to get rid of this and similar problems?
Exception:
System.Reflection.ReflectionTypeLoadException
HResult=0x80131602
Message=Mindestens ein Typ in der Assembly kann nicht geladen werden. Rufen Sie die LoaderExceptions-Eigenschaft ab, wenn Sie weitere Informationen benötigen.
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes() in f:\dd\ndp\clr\src\BCL\system\reflection\module.cs:line 1118
When I continue the test a tab appears in which is written "module.cs not found"
In the LoaderException property are two identical entries:
"Der Typ \"Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope\" in der Assembly \"Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" konnte nicht geladen werden.":"Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope"
My current development system
Microsoft Visual Studio Community 2017
Version 15.9.4
VisualStudio.15.Release/15.9.4+28307.222
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Community
Application Insights Tools for Visual Studio Package 8.14.11009.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2017 5.2.60913.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.3.3000.2
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 15.9.02046.0
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.3.3000.2
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Fabric.ApplicationInsights 1.0
Allows user to instrument their Service Fabric projects for Application Insights.
Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events
GitLab Extension for Visual Studio 1.0.166
A Visual Studio Extension that brings the GitLab Flow into Visual Studio.
JavaScript Language Service 2.0
JavaScript Language Service
Microsoft Azure HDInsight Azure Node 2.3.3000.2
HDInsight Node under Azure Node
Microsoft Azure Hive Query Language Service 2.3.3000.2
Language service for Hive query
Microsoft Azure Service Fabric Tools for Visual Studio 2.4
Microsoft Azure Service Fabric Tools for Visual Studio
Microsoft Azure Stream Analytics Language Service 2.3.3000.2
Language service for Azure Stream Analytics
Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 1.0
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Office Developer Tools for Visual Studio 2017 ENU 15.0.28224.00
Microsoft Office Developer Tools for Visual Studio 2017 ENU
Productivity Power Tools 2017/2019 16.0
Installs the individual extensions of Productivity Power Tools 2017/2019
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.61810.11040
Microsoft SQL Server Data Tools
Switch Startup Project 4.0.44
Provides a toolbar dropdown box to switch between startup projects.
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.