I have found various iterations of this question across a number of websites, however so far I have not found anything that provides a full answer that worked.
I have just set up a number of Visual Studio Test Agents that all appear to be behaving and running most of the unit tests we are planning on initially running on them. However when I came to checking one of the unit tests it is failing on the line:
using (ShimsContext.Create()),
With the stack trace:
Result Message:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
Having read some other posts I installed Visual Studio 2013 on the test agent and confirmed it would run the test locally. I then set COR_PROFILER_PATH to the profiler that was being used on my machine which was installed at: “C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll”.
It then failed in the same place with the trace:
Test method threw exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to get profiler module handle 'C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll'. The specified module could not be found ---> System.ComponentModel.Win32Exception: The specified module could not be found
The suggestion is the profiler has been loaded under a separate process and can't be used. Has anyone had any success with this or similar set ups? At a fundamental level can Visual Studio Test Agents run tests with Fakes?
Thanks
I know this is a bit old, so the OP probably got his answer, but for anyone else, I opened a ticket with Microsoft on this issue, and the answer we came to after an hour and a half of looking at my setup for this problem:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
, was that I was using mstest.exe and I should have been using vstest.console.exe. In my case it was because I have Fakes test in my code now.
I'm using Visual Studio 2013 update 4.
I was having the same issue with a project I was working on. I found this issue noted:
https://connect.microsoft.com/VisualStudio/feedback/details/832744/unable-to-debug-shims-based-tests-unittestisolation-exception
There was an attached project, so I downloaded the project and ran the only unit test. Same error - the unit test was not successful. However, I right-clicked on System under the References, and clicked Add Fakes Assembly. Once it had generated the fakes for System and mscorlib, voila! The test turned green.
I was able to reproduce the issue in my project - I did not have fakes being generated for System. Once I generated them for System, my tests went from red to green!
Side note -- If you don't want to generate ALL of the fakes for System and mscorlib, you can modify the .fakes files like so.
mscorlib.fakes:
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="mscorlib" Version="4.0.0.0"/>
<StubGeneration Disable="true" />
<ShimGeneration Disable="true" />
</Fakes>
System.fakes:
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="System" Version="4.0.0.0"/>
<StubGeneration Disable="true" />
</Fakes>
I could not disable ShimGeneration for System.fakes - the test would fail.
I hope this fixes the problem for someone else - the error is extremely vague!
(I'm assuming your Test Agent is also a Build Agent.)
Is the build service version synced with the Visual Studio version which is installed?
I had the same issue in the following environment:
TFS 2013
Build Server w/ TFS 2013
Visual Studio 2015.3 installed in the build server
When I updated the TFS version on the build server to 2015.3, the issue stopped happening.
I know it may not make sense, but solved the problem as the TFS 2015 XAML Build is compatible with TFS 2013.4 app tier.
Related
I've been searching all morning for an answer online to this and I have tried a lot of the suggestions though all solutions seem to be for visual studio 2010 and I am running 2013 premium edition, I can't see anyone with the same problem.
I have premium VS 2013, I installed SpecFlow v1.9 through the extension manager and added the SpecFlow nuget package. I have created a CodedUI test project and added a feature file, some recorded codedui steps and a stepdef file. Nothing is complaining and it all looks like it should work. I have added :
<unitTestProvider name="MsTest"/>
to my App.config so I can run it from the test explorer in visual studio. I eventually want to run the tests via MTM but I will deal with that when I get this to work!
I have built and it is all happy so I go to test explorer and I can see my test so I right click, run the test. It fails with the following error, it does get to my Given step when I debug and falls over trying to open my application.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I can not find the reference above when I have looked to add it to my project references, there is a similar one but it breaks some of my other references when I add it. I also had a look at my registry files and the path it is referring to does not exist for me to edit it. From what I have read codedui doesn't work nicely with specflow without a dll file. All references to this fix seem to be for vs 2010 and require that I copy a dll to my specflow source folder. I installed specflow from visual studio so I don't have a program files folder for it so I came to a bit of a sticking point with that solution.
Does anyone have specflow working with visual studio 2013 and a codedui test project? Am I missing a set up step? Or is this genuinely to do with my registry files / references. The error is confusing as I don't see why it is trying to find that reference especially when I can't find that reference anywhere when I try to find it manually. I'd be interested to know if you have had this error and managed to resolve it or if you could explain your set up steps so I can check I did not miss anything.
Thanks!
I believe you might be missing references to some of the required dlls. I just finished testing a test created using a Specflow, codedUI test project on my MS Visual Studio 2013 ultimate and it worked just fine.
Here are the steps which I followed:
Created a class library project.
Added reference to Specflow 1.9 from Extensions and Updates.
Added reference to Specflow CodedUI Attribute Generator (Install-Package SpecFlow.CodedUI -Version 1.0.0.23).
Added references to required libraries required for CodedUI and Test Tools to the project. See below the references I added.
Microsoft.VisualStudio.QualityTools.CodedUITestFramework
Microsoft.VisualStudio.QualityTools.UnitTestFramework
Microsoft.VisualStudio.TestTools.UITest.Common
Microsoft.VisualStudio.TestTools.UITest.Extension
Microsoft.VisualStudio.TestTools.UITest.ExtensionUtilities
Microsoft.VisualStudio.TestTools.UITesting
Added a separate CodedUI project to solution and added references of this project to the class library project.
Create a new Specflow feature file with some test and create step for it in step definition and reference to the function you created or recorded in the CodedUI project in the step definition.
Run the Specflow test from Test Explorer. It should work fine.
Note: The above steps should work just fine if you will create CodedUI project instead of a Class library project.
Mark the test class with the CodedUITest attribute.
I had this exact error message even though I had all the .dll's referenced correctly.
The solution for me was to regenerate the feature files.
(right click project and select "regenerate feature files")
Leaving this answer in case it helps someone in future.
I came across the same issue today, not with specflow but 2013 build controller and agent and codedui tests.
The solution was to install VS2013 Update 5 https://www.visualstudio.com/downloads/download-visual-studio-vs
I had same problem, found the following solution works well:
http://blog.majcica.com/2015/05/07/getting-started-with-specflow-and-codedui/
I am attempting to run SpecFlow tests from the Visual Studio 2010 Command Prompt, and I am getting a rather obtuse error message:
Unit Test Adapter threw exception:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..
Some info about my VS2010 Project setup:
Windows 7 Enterprise, 64 bit (Version 6.1.7601 Service Pack 1 Build 7601)
Visual Studio 2010 Premium (v10.0.40219.1 SP1Rel)
Using Coded UI Tests
Using SpecFlow 1.9.0, which delegates to the CodedUI test API
MSTest
.NET v4.0.30319
Whole solution is compiling to 32 bit code (I have coworkers using XP still)
I have a post-build event that copies a few DLL files from my NuGet packages directory to the target dir:
copy $(SolutionDir)packages\SpecBind.1.2.1.71\lib\net45\SpecBind.dll $(TargetDir)
copy $(SolutionDir)packages\SpecBind.CodedUI.1.2.1.71\lib\net45\SpecBind.CodedUI.dll $(TargetDir)
Without this, mstest somehow couldn't load a number of SpecFlow assemblies.
Relevant Parts of Test Project's App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
<section name="specBind" type="SpecBind.Configuration.ConfigurationSectionHandler, SpecBind" />
</configSections>
<connectionStrings>
...
</connectionStrings>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<unitTestProvider name="MsTest" generatorProvider="Specflow.CodedUI.MsTestCodedUiGeneratorProvider, Specflow.CodedUI" runtimeProvider="TechTalk.SpecFlow.UnitTestProvider.MsTest2010RuntimeProvider, TechTalk.SpecFlow" />
<stepAssemblies>
<!-- This attribute is required in order to use StepArgument Transformation as described here;
https://github.com/marcusoftnet/SpecFlow.Assist.Dynamic/wiki/Step-argument-transformations -->
<stepAssembly assembly="SpecFlow.Assist.Dynamic" />
<stepAssembly assembly="SpecBind" />
</stepAssemblies>
</specFlow>
<specBind>
<browserFactory provider="SpecBind.CodedUI.CodedUIBrowserFactory, SpecBind.CodedUI" browserType="IE" />
<!-- For additional details on SpecBind configuration options see the project site. -->
</specBind>
</configuration>
The command I was using to start the tests:
C:\path\to\bin\Debug> mstest /testcontainer:MyTests.dll /test:SpecFlowFeatureName
Loading MyTests.dll
Starting Execution...
Results Top Level Tests
-------- ------------------
Failed ...
Failed ...
Failed ...
...
I've been searching high and low for a solution, and all I keep finding is references to VS2008 and disabling Code Coverage. I have VS2010 and Code Coverage is not enabled in my local test settings.
Windows Event Log Viewer
After rooting around in my Windows Event Log viewer, I finally came across more info (I've heard people complain they can't find a stack trace with this error -- look in your Event Viewer)
The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
(QTAgent32.exe, PID 6920, Thread 213) Unit Test Adapter threw exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.GetAssemblyInfo(Assembly assembly)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.GetTypeInfo(Type type, Boolean checkAlreadyExaminedType)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ResolveMethods()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Initialize(UnitTestResult result, UnitTestRunner runner, ConsoleOutputRedirector redirector)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
the message resource is present but the message is not found in the string/message table
I don't know how to resolve this error. SpecFlow tests run fine from inside Visual Studio when I right-click in a .feature file loaded in the editor and choose "Run SpecFlow Scenarios..." but I can't run them from the command line.
Any ideas, or additional information I could post?
As a side note, this stemmed from my earlier question: How do you run SpecFlow scenarios from the command line using MSTest?
Update #1
I did a little more poking around, and found this blog post: MSTest and 64bit. I checked my local test settings, and it is forcing the tests to run in 32 bit.
Now using this command:
mstest /testcontainer:MyTests.dll /testsettings:"..\..\..\Local.testsettings"
Error message:
Test method Blah.Dee.Blah threw exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.Extension, Version=11.0.0.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
TestCleanup method Blah.Dee.Blah.ScenarioTearDown threw exception. BoDi.ObjectContainerException: BoDi.ObjectContainerException: Interface cannot be resolved: SpecBind.BrowserSupport.IBrowser.
Update #2
I removed the reference to Microsoft.VisualStudio.TestTools.UITest.Extension and added it back. Cleaned. Rebuilt. Ran the same command again. Still getting the same error.
For some reason it's trying to load the Microsoft.VisualStudio.TestTools.UITest.Extension assembly as Version 11, and I have Version 10 installed on my machine. I'm trying to track down where this version is being specified so I can change it.
Just in case anyone else comes across this, for me it was because code coverage was enabled. Disabling it resolved the issue:
http://blogs.msdn.com/b/danielvl/archive/2010/02/16/enable-code-coverage-in-visual-studio.aspx
Open the .testsettings file
Under "Test Settings", click "Data and Diagnostics"
Uncheck "Code Coverage"
Hit "Apply"
With the help of #jessehouwing's comment above, I've got this fixed. I was running into two problems.
The error I originally referenced was actually caused by mstest attempting to run the tests in a 64bit process (QTAgent.exe). I needed it to run as a 32 bit process because the project was compiled as 32 bit code on my 64 bit Windows 7 machine.
In Visual Studio 2010:
Click the "Test" menu -> "Edit Test Settings" -> "Local (local.testsettings)"
Click "Hosts" in the left hand panel
Make sure "Force tests to run in 32 bit process" is chosen in the "Run tests in 32 bit or 64 bit process" drop down. For me this was the default
In the Visual Studio Command Prompt, run the tests by referencing the local.testsettings file generated by Visual Studio:
mstest /testcontainer:foo.dll /testsettings:"path/to/solution/local.testsettings" /test:SpecFlowFeatureName
The second problem I had was my own fault. Earlier I was playing around with Coded UI tests and SpecFlow and had installed SpecBind, which threw a bunch of settings in App.config for my test project. This NuGet package is only for .NET 4.5, and we use .NET 4.0. I removed that NuGet package and settings from App.config, cleaned and rebuilt. This fixed this issue completely.
So in short, I:
Forced mstest to run in a 32 bit process, and referenced this local.testsettings file from the command line
Removed all references to SpecBind because I got a little NuGet-happy earlier and installed a package incompatible with my .NET runtime.
As you can see by looking at the assembly references required by these packages (I use Reflector for this, but IlSpy or JetBrains' DotPeek will work as well), you'll see that they depend on the v11 version, which is the version that ships with Visual Studio 2012. These can't be used in Visual Studio 2010.
Removing SpecBind will probably help, or finding a version that depends on an older version of CodedUI (you're probably looking for a much older version of SpecBind in this case).
As for your 32-bit issue, you should probably set your project's CPU configuration to AnyCPU, there is normally no need to fix it to x86, unless you're dependent on native methods or if you're referencing other assemblies that are specifically set to use x86 as their target architecture.
This is so troubling.....
I had Test Agent for Visual Studio 2015 installed on my test machine, since we were planning to use it - while on my local machine I had 2013. The tests ran so perfectly with MsBuild on local, that I couldn't understand what could have happened given that I always assumed Microsoft always maintained backward compatability.
MsBuild on test server failed to give any information as to what assemblies were missing (I added Newtonsoft.Json just because it complained initially, but after that I never saw the names of anything else missing). The error message was truncated, stacktrace and debugtrace options never worked...
Once I installed Test Agent for Visual Studio 2013 on the test machine, it ran like a charm.
I started creating automated builds in TFS 2012 using a build server with VS2012 on it. Everything was running fine, but then we updated the build server to VS2013(still with TFS 2012). Now no units execute. I get the error:
Handle Test Run Exception
Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.Utilities,
Version=11.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
I can find that file on the build server but only version 12 under vs2013.
Im lost as to what to do as I dont know what is forcing the Test Runner to use version 11 or how to change it.
Is it possible that since the build controller is tfs 2012, it is somehow forcing the Test Runner in the build to use version 11 instead of version 12 on the build server? Any ideas how to resolve this?
You need to have VS Professional or later on your build server to run automated tests as a part of your build process.
Here since TFS is still at 2012 the test activities are referring the 11.0 dlls and installing VS2012 should help resolve this issue.
This is a known bug being tracked.
From http://msdn.microsoft.com/en-us/library/ms253138.aspx
To run unit tests, or coded UI tests, you must install Visual Studio
Professional or later
(I'm running Windows7 and using Visual Studio 2010.)
I'm using ClamAV in a .NET Azure project, and I'm running into side-by-side errors whenever I run clamd.exe, either through my code or by running clamd.exe on it's own.
In Visual Studio 2010 I am getting the error:
Win32Exception was unhandled The application has failed to start
because its side-by-side configuration is incorrect. Please see the
application event log or use the command-line sxstrace.exe tool for
more detail
And in Event Viewer I get:
Activation context generation failed for
"C:\Users\pconerly\code\AntiVirus_source\WorkerRole\clamav\clamd.exe".
Dependent Assembly
Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
could not be found. Please use sxstrace.exe for detailed diagnosis.
When I searched for "8.0.50727.6195" it led me to the 2005 redist, so I downloaded it
http://www.microsoft.com/download/en/details.aspx?id=3387
After a restart I am still getting the side-by-side error. Additionally, I think that the redist installer is not completing it's install-- like it's seeing visual studio 2010 and saying "oh, that's good enough, no need for me to install". I haven't tried uninstalling 2010 and using 2005, because the rest of my Dev team is using VS 2010.
What's the deal? How can this be fixed? I'm ready to pull out my hair.
The link Timores posted is the update for Visual Studio. The actual redistributable package is this:
http://www.microsoft.com/en-us/download/details.aspx?id=26347
The version you mention is actually at found here
Microsoft Visual Studio 2005 Service Pack 1 MFC Security Update
Timores is right: the redist should be this one, which is related to this KB entry
As you can see there, msvcr80.dll has been updated to version 8.0.50727.6195.
It is the "security update" of the "SP1" of the 2005 C++ runtime..
Your exe probably requires (through an internal manifest) that specific version.
If it is not found on the system (there's a lot of places searched for) nor in the current folder (with a suitable manifest aside) it won't load the exe since it is not able to "activate the context", that is load the specific DLL required in the manifest.
I had similar issues when my system got updated (windows updates) and the newly compiled EXEs were not working with an old-versioned runtime placed on the same folder.
I had to update msvcr80.dll and its manifest (which I found deep in \windows\winsxs) to make everything work.
Context activation is a tricky matter, anyway :)
HTH
I recently create a couple of VSPackages for some Visual Studio extensions (menu bar/command). I compiled them correctly yesterday, checked into TFS (i'm the only one touching this project, FYI). I had already installed these extensions and were working fine. Today it doesn't compile! I get the following error:
Exception has been thrown by the target of an invocation.
This doesn't tell me anything, so i fired up Visual Studio with the following command:
devenv.exe /Rebuild > out.log
In my out.log, I see the following:
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets(420,5): error : Exception has been thrown by the target of an invocation.
I have been stuck on this for hours and can no longer build these VSPackages. Anyone? This is really frustrating. I have already tried cleaning project/rebuilding/build using Visual Studio itself (not command line)
I've experienced this issue several times in both vs2010 and vs2012, and manually deleting the "bin" and "obj" folders from the project then doing a "rebuild" normally does the trick.
Further to the answer provided by the OP, I will provide it here for completeness instead of relying on the external link remaining live:
Quoted directly from the MSDN forum answer:
Do you happen to have these extensions installed to the AllUsers
location (i.e. %VSInstallDir%\Common7\IDE\Extensions)?
You mentioned in your initial post that "I had already installed these
extensions and were working fine."
The task that's failing (based on the line number in the targets file)
is the UninstallExtension task. The only reason I'm thinking this task
would execute and fail in your situation is if you're building an
extension that's already installed to the Common7\IDE\Extensions
directory.
Regards, Aaron
I find myself on this question because of exactly the same build issue of a VSIX Installer Project for our project templates. This solved my issue.
Indeed, I uninstalled the prior version of our templates and the build occurs without issue.
Have you double checked that all of your projects are using compatible framework versions?
As in you can't use a .Net 4.0 assembly in a .Net 3.5 project.
Is the project linked with source control like TFS? If so then take latest from TFS and try again.
Are you running Visual Studio as Administrator?
Maybe you have insufficient rights for some file (copy/move/delete) especially in bin or obj folders.