Thursday, December 01, 2005 10:38 PMI am running unit tests and receive the following error when selecting the Run Selection option from a test:
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..
I can choose the Debug Selection option and am able to run the test that way.
Here is an example of one of the logs in the Assembly Bind View Log app.
I have already tried re-referencing the assembly with no luck
*** Assembly Binder Log Entry (12/1/2005 @ 5:33:38 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running under executable C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = MASTER\pactis LOG: DisplayName = Microsoft.VisualStudio.QualityTools.Common, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///c:/pwf protoypes/development/picisweb/piciswebframeworkcomponentstest/bin/debug LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: c:\pwf protoypes\development\picisweb\piciswebframeworkcomponentstest\bin\debug\piciswebframeworkcomponentstest.dll.config LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: Microsoft.VisualStudio.QualityTools.Common, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL file:///c:/pwf protoypes/development/picisweb/piciswebframeworkcomponentstest/bin/debug/Microsoft.VisualStudio.QualityTools.Common.DLL. LOG: Attempting download of new URL file:///c:/pwf protoypes/development/picisweb/piciswebframeworkcomponentstest/bin/debug/Microsoft.VisualStudio.QualityTools.Common/Microsoft.VisualStudio.QualityTools.Common.DLL. LOG: Attempting download of new URL file:///c:/pwf protoypes/development/picisweb/piciswebframeworkcomponentstest/bin/debug/Microsoft.VisualStudio.QualityTools.Common.EXE. LOG: Attempting download of new URL file:///c:/pwf protoypes/development/picisweb/piciswebframeworkcomponentstest/bin/debug/Microsoft.VisualStudio.QualityTools.Common/Microsoft.VisualStudio.QualityTools.Common.EXE. LOG: All probing URLs attempted and failed. Any help is greatly appreciated.
Tuesday, December 06, 2005 4:15 PMDo you have code coverage enabled?
I've seen this exception on two occasions so far.
First time was when I was using code coverage, and I didn't specify a key for assembly re-signing. This would work in debug mode because code coverage by design is disabled in debug mode.
Second time was when I tried to run a unit test in which my [ClassInitialize] and
[ClassCleanup] methods were not defined as static.
Tuesday, December 20, 2005 10:51 PM
Please provide more information:
- Do you see any run level warnings when you have this error? To see them click on "test run finished"/"test run warning"/"test run error" link in Test Results Window toolbar.
- Is your test assembly strongly signed or are any of your assemblies it references strongly signed?
- Is code coverage enabled?
- Are there any tests shown in Test Viewer/Manager as Disabled (with icon that has red "Cancel" circle)?
- Please run fuslogvw.exe, clear all messages, then run your test so that it fails, refresh messages in fuslogvw.exe and include all logged entries to your reply. Normally the error should come from vstesthost.exe process. Your original email had error entry for MS.VS.QT.Common.dll from devenv.exe, you should have another successful entry for this assembly from devenv.exe in your fuslog.
Visual Studio Team System
Friday, December 23, 2005 7:33 PM
I am experiencing a similar problem and was hoping that you could help. I created the VSTSDemo project from MSDN and tried to hook up a datasource and got the same error. I have the released Visual Studio 2005 for Software Developers 8.0.50727.42 (RTM.050727-4200)
My run level warnings start with:
Message 1 Could not find schema information for the element 'microsoft.visualstudio.qualitytools'. C:\Data\VSTSDemo\VSTSDemo.Test\App.config 10 4 VSTSDemo.Test
The others are the same with the rest of the elements & attributes from the app.config.
My assemblies are not signed and I don't know if the Microsoft.VisualStudio.QualityTools.UnitTestFramework assembly is or not.
Code coverage is not enabled and there are no disabled tests.
The output from fuslogvw.exe is as follows:
*** Assembly Binder Log Entry (12/23/2005 @ 12:28:05 PM) *** The operation was successful. Bind result: hr = 0x0. The operation completed successfully. Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running under executable C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\vstesthost.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = CORP\billo LOG: DisplayName = Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent, Version=184.108.40.206, PublicKeyToken=b03f5f7f11d50a3a (Partial) LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/ LOG: Initial PrivatePath = NULLLOG: Dynamic Base = NULLLOG: Cache Base = NULL LOG: AppName = vstesthost.exe Calling assembly : Microsoft.VisualStudio.QualityTools.AgentObject, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\vstesthost.exe.config LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent.DLL. LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent.DLL. LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent.DLL. LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy. LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\vstesthost.exe.config LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: GAC Lookup was unsuccessful. LOG: Binding succeeds. Returns assembly from C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAgent.dll. LOG: Assembly is loaded in default load context.
Monday, January 23, 2006 5:23 PM
Can you please provide the following information:
- What exactly is the problem you are seeing?
- How did you create VSTSDemo project, where did you download it from, and how did you modify it? If you tried to use .config file redirection for data source, you can find an example of .config file in this post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=215723&SiteID=1&mode=1
- What does your .config file contain? (email to me is fine)
- Fusion log is successful, it found the assembly. Do you see fusion errors?
Monday, November 06, 2006 9:28 AM
I had the same error.
After some searching it turned out that a drive containing the external assembly which it complained about was not available, although compilation did just work.. probably because of copy-local.
I experimented some more and found that the easiest way to detect the assembly is to first perform a "Clean solution" in Visual Studio and then perform a "Rebuild All". This way, all dependencies wil be re-checked with compilation, and the compiler will simply complain about the missing assembly. Of course you could also use fuslogvw.exe, but I think this solution is often easier.
Friday, July 06, 2007 4:19 PMI ran into this error after another user renamed the project folder in TFS. The problem was the test run configuration had code coverage enabled for the assembly in the old folder. I changed that in the Test->Edit Test Run Configurations->Local Test Run dialog under Code Coverage by unchecking the assembly referenced in the old path and checking the assembly in the correct path.
Tuesday, September 11, 2007 2:28 PMAnd I ran into this error on our TFS server when I accidently entered an absolute path to the key file used for instrumentation. The absolute path worked fine on my local developer box, but of course a relative path was needed to make it work on the build server.
And in my case, I have a shared SNK file two levels above the solution folder. So the value I specified to work things out was "..\..\mykey.snk", instead of the full path "c:\....".
I guess this only applies to build environments where the developer machines doesn't use the same folder structure as the build server. If you have the same folder structure in both places, absolute paths would probably work as well as the relative ones.
Wednesday, November 28, 2007 9:36 PM
Yeah, I got the problem where the tests would run in "Debug" mode, but not in normal "Run" mode, and it was related to code coverage and assembly signing. In order to perform code coverage, it seems VS has to modify the assembly with some sort of tracking hooks. If your assemblies are signed, this means VS needs to resign them for them to load properly.
What isn't as obvious is that while you specify the original SNK file for the assembly by going to Project => Properties => Signing, you have to go to Test => Edit Test Run Configuration => [your configuration] => Code Coverage to specify the resigning key for code coverage purposes. In my case, these two keys didn't match. Pointing them both at the same key fixed the problem.
Saturday, July 04, 2009 6:39 PMthanks mate. . .this thing worked for me. . Cheers ! :)
- Proposed As Answer by k0v1d Wednesday, August 25, 2010 9:29 AM
Wednesday, August 25, 2010 9:29 AM
For VS 2010->
Go to Test-> Edit test setting-> Local->Deployment-> Add Folders(Debug/Release Path of all dlls)/Files (or specific dlls required).
- Proposed As Answer by JasKaur Monday, May 23, 2011 1:11 PM