GoogleTest - error E0145 - "google::protobuf::internal::ExtensionSet::kMaximumFlatCapacity" may not be initialized - c++

I was adding some code to a project and wanted to add a Google Test case for it, on the unit testing project called UnitTests. Everything was going fine, my test failed because of some silly copy+paste mistake I made but after I fixed it I couldn't run the test anymore because during the build stage I'd get this error
Error (active) E0145 member
"google::protobuf::internal::ExtensionSet::kMaximumFlatCapacity" may
not be initialized UnitTests
Which stems from google\protobuf\extension_set.h.
and
Error LNK1104 cannot open file '\UnitTests.exe'
I commented-out my new test and tried to rebuild but encountered the same issue.
Then I tried to change to a different branch in my local repository - one without any of that new code and building the unit tests project still resulted in the same issue.
What could be the problem?
I'm using Visual Studio 2017 if it could matter.
Thanks.

Related

Specflow skips test after execution with error: Error while unpacking executor:

after updating SpecflowRunner to 3.5.8 and re-installing the Specflow Package 2017.2.1 my tests cannot be executed and are skipped instead. When I open the log file I find this Error message:
Error while unpacking executor: System.TypeLoadException: The method "Initialize" in type "TechTalk.SpecRun.Framework.TestAssemblyExecutor" of the assembly "TechTalk.SpecRun.Framework.Executor, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null" is not implemented.
(Sorry, I had to translate the message)
A friend of mine has the same versions, but everything runs smoothly. We both use Visual Studio 2017.
Did I miss something, a cache that has to be cleared or anything else?
You have probably some old leftover files from before the update in your obj and bin folder.
Close Visual Studio
delete the folders
start Visual Studio
Rebuild Solution
After that, you should be able to execute your tests again.

Error MSB3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2

I'm building web application using asp.net core 2x and angular 5,during development/debug mode everything is getting build well.But when i try to publish it with release mode in visual studio 2017 am getting this error.please help me to resolve this.Am not using this in my code but it exists. Function calls are not supported in decorators but 'makeParamDecorator' was called in 'Injectable'
'Injectable' calls 'makeParamDecorator'.Please help.Thanks in advance.Screenshot of my error message
You need to run this on console:
node node_modules/webpack/bin/webpack.js --env.prod
then you will get the list of all the issues, and need to solve all of them, someone gonna be like:
ERROR in navmenu.component.html: Property 'auth' is protected and only accessible within class 'NavMenuComponent' and its subclasses.
another case:
ERROR in Error at estados.component.html(19,72): Expected 0 arguments, but got 1.
Error at home.component.html(8,12): Property 'selectedCharacter' does not exist on type 'HomeComponent'. Did you mean 'selectedCharacters'?
Each error have a different solution, you need to solve them all.
You can check this link:
Angular – The command “node node_modules/webpack/bin/webpack.js –env.prod” exited with code 2 and similar errors: how to fix them

boost-test 'filename'.test.report.xml not found

I use Visual Studio adapter for Boost.Test. I built boost.test[v1.59] project using cmake.
I didn't have any compile problems but when I tried to run tests I got the output like below:
Executing: -> [BoostUnitTestSample]
filestream was found to be null when handling path: D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe.test.report.xml
Exception caught while running test batch D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe [BoostUnitTestSample]
(File 'D:\Work\Project\dev\DesktopMSVC13_Project\src\ProjectTest\Debug\ProjectTest.exe.test.report.xml' not found.)
========== Run test finished: 0 run (0:00:03,6081912) ==========
Everything goes fine if I add a boost.test project manually
My experience with the Boost.Test extension for Visual Studio (see comment) tells me that you forgot to set references to dependencies required to run the tests (typically DLLs). I think the message is rather created by the standard test execution engine than by Boost.Test extension. It is just a clumsy way of saying "oh, the test did not run, so I could find the results..."

Unit Testing Framework - An error occurred while parsing entityname

I have created simple MS Unit Test Project. Assert.Equal(true, true).
When I want to run a test I receive a error from Resharper and Visual Studio.
"Unit test Runner failed to run tests
System.Xml.XmlException: An Error occured while parsing EnityName. Line 1, position 17."
Do I missing something.
Edit:
I can't add screenshot and I can't select text to copy. Ok I will write it the best I can.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.xml.XmlTextReaderImpl.Throw(String res,String arg)
at System.Xml.XmlText.ParseEnityName()
at System.Xml.XmlTextReaderImplparseEnityReference
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextLoader.ParsePartialContent(XmlNode parentNode,String innerxmltext, xmlNodeType nt)
at System.Xml.XmlElement.set_InnerXml(string value)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingHelper.AppendOrModifyChild(XpathNavigator,String nodePatH,String nodeNAME,sTRING INNERxML)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.UpdatedRunConfiguration(XPathNavigator, ArchitectureeffectivePlatform,FrameworkVersion effectiveFramework,String resultsDirectory,String solutionDirectory,String binariesRootDirectory)
Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.MergeRunSettingsAndFindCompatibleSource()
at JetBrains.ReSharper.UnitTestProvider.MSTest11.MsTest11Runner.Run(IRemoteTaskServer server,String assemblyLocation,String runConfigurationFilename,IUnitTestRun run)
To solve this problem you don't need to reinstall Visual Studio or Resharper.
The problem was in a file path to my projects. This would explains why other Unit Test projects were fine because there were in a different location.
I guess this a bug inside Visual Studio Unit Testing Framework. If you have unit test project inside folders with special charts like '&' then Visual Studio will crash or Resharper will return this message.
I wonder where I can report this bug.
I have just run into this problem too and followed the advice above.
First my path had a folder named ...\m&e...
Then I copied the whole project folder to a new location without an '&' in the path.
After that everything was working well.

MSTest exception: Unit Test Adapter threw exception: Type is not resolved for member

In my project I write tests using Microsoft's unit testing framework. All of my tests pass when I run them from Visual Studio but when I run the tests from MSBuild all of the tests fail with the following erorr message:
Unit Test Adapter threw exception:
Type is not resolved for member
SomeType,SomeAssembly Version=assemblyVersion,
Culture=neutral, PublicKeyToken=..
The assembly not found is a 3rd party assembly referenced by all of the projects.
The build script is used by TFS so I've aded the following lines:
<RunTest>true</RunTest>
<ItemGroup>
<MetaDataFile Include="$(BuildProjectFolderPath)myproject.vsmdi">
<TestList>CI_Tests</TestList>
</MetaDataFile>
</ItemGroup>
I've found the this post that shows a solution to this issue but unfortunatly I cannot chnage the files on the TFS server.
Help!
I encountered the same problem in my unit tests. The linked article above indicates that the problem is that VSTS causes copying of some objects in the thread's CallContext.
For what it's worth, in my case the problem was that I had manually placed an object in the thread's CallContext, which caused this exception. I was able to resolve this by clearing the CallContext in my TestCleanup routine. I didn't have to change any files anywhere.
I had also run into the same issue but where I had StructureMap initialisation being performed within the constructor for a base test class.
I was able to get around the problem by moving the call from the constructor to the [TestInitialize] method. I also ensured that the [TestCleanUp] method disposed of the created StructureMap container. After this MSBuild (2010) would run through the tests without raising this error.
The first thing to check would be if this assembly is copied to the folder from which msbuild runs the tests. It might be the case that you have a copy in your bin/Debug folder because of some historic reasons, but the dependency is not set up properly in the project.
Had this error
Unit Test Adapter threw exception:
Type is not resolved for member 'NHibernate.HibernateException,NHibernate
As it turned out the problem was in exception thrown in static constructor for the test.
It was completely unrelated to the looks of message and was happening during DB creation using BuildSchema.
Very uninformative error message by MSTest which cost me a lot of hours and stress. putting migration to something better like NUnit in our TODO list.
This article solved my problem with this error:
To recap, MyCustomException was thrown at very early stage of test execution. The dll that contained it was not loaded yet so Unit Test Adapter indeed could not reach it.
Happening when the assemblies been tested have loaded instances of their class marked as [Serializable]. Workaround by deriving from MarshalByRefObject so the deserialization is no longer attempted from mstest host.