Got LoaderExceptions in setting specflow 1.9 in for WindowsPhone - windows-phone-7

I tried to follow
https://github.com/Expensify/WindowsPhoneTestFramework/wiki/Setting-up-a-new-BDD-machine
to setup Specflow on WindowsPhone.
I had a Specflow 1.8.1 installed. so I uninstall 1.8.1 first and install Specflow 1.9 plugin on VS2010.
When running the Specflow. I still got following exception.
[ERROR] Add two numbers: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
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 TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.Initialize(Assembly[] bindingAssemblies)
at TechTalk.SpecFlow.TestRunner.InitializeTestRunner(Assembly[] bindingAssemblies)
at TechTalk.SpecFlow.Infrastructure.TestRunnerFactory.Create(Assembly testAssembly)
at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Boolean async)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner()
at ClassLibrary1.SpecFlowFeature1Feature.FeatureSetup() in C:\source\PhoneApp1\ClassLibrary1\SpecFlowFeature1.feature.cs:line 0
at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(TestThreadExecutionContext testThreadExecutionContext) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework\TaskExecutors\StaticOrInstanceMethodExecutor.cs:line 40
at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.Execute(TestThreadExecutionContext testThreadExecutionContext) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework\TaskExecutors\StaticOrInstanceMethodExecutor.cs:line 21
at TechTalk.SpecRun.Framework.TaskExecutors.ChainedTaskExecutor.Execute(TestThreadExecutionContext testThreadExecutionContext) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework\TaskExecutors\ChainedTaskExecutor.cs:line 20
at TechTalk.SpecRun.Framework.TestThreadExecutor.ExecuteTestNodeTask(TestNode testNode, ITaskExecutor task, TraceEventType eventType) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework\TestThreadExecutor.cs:line 220
The internal exception is LoaderExceptions include
{"Could not load file or assembly 'TechTalk.SpecFlow, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"TechTalk.SpecFlow, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0778194805d6db41"}
I don't know why it still load 1.8.1 SpecFlow assembly. I have uninstalled the SpecFlow 1.8.1. Is there any other place I need to change manually?
Thanks!

The WP7Test package seems to have a dependency to SpecFlow 1.8.1. As far as i see on the github project, it has not been updated yet to SpecFlow 1.9.
SpecRun.SpecFlow 1.1 requires SpecFlow 1.9. (This will be used if you install the obsolete SpecRun (1.0) package.)
I think the best would be to fork the WP7Test project on github and update it to use SpecFlow 1.9. After doing this it should also work fine with the latest SpecRun.
(An alternative way would be to use SpecRun.SpecFlow 1.0 package that works with SpecFlow 1.8.1 and also supported by the SpecFlow 1.9 IDE integration.)

Related

Error MT2001: Could not link assemblies. Reason: Error while processing references

I'm getting this error trying to build a Xamarin.iOS project referencing a .NET Standard 2.0 library.
None of the MT2001 issues online seem to have this specific "Error while processing references" reason, so I'm at a loss as to how to diagnose this. I've tweaked and fiddled about as much as any one person can and stay sane, but I'm really in the dark.
Can anyone out there point me in a direction?
Adding -v -v -v -v to "Additional mtouch arguments" in the project iOS Build settings will help diagnose the issue. After that, you can search the build output for MT2001 and view the inner exceptions. Obviously, each project may differ as to what assembly causes the linker to fail. You may need to add, remove or fix your references based on the output.
For example, I was trying to use SignalR from AspNetCore 2.1, which has a dependency on System.Threading.Tasks.Extensions 4.5.1 in my project, which it seems Mono does not yet support. Mono does not provide its own version of the assembly yet, so when mtouch goes to link the assembly, it's unable to do so and throws an exception:
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Removing all references to this assembly (and therefore the whole feauture in my case) allowed the build and linking to succeed.
I've found that I get this when using a Xamarin library that is dependent on System.Reactive 4.1.0. There's a bug in there associated with System.Threading.Tasks.Extensions, and since it is a library I'm writing, I had to roll back to System.Reactive 4.0.0.
For me the error is as follows.
one of the package is mentioned in package.config file but it was not available in packages. So i added the missing package from nuget and the app works fine

GENERATEFAKES fails with CS0234

My project builds for my teammates, but not for me.
Project:
Errors:
I deleted reference to mscorlib fake, recreated Fake for System, but got the same error.
If I try to add reference to mscorlib, I get message:
A reference to
'C:\Windows\Microsoft.NET\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
could not be added. This component is already automatically referenced
by the build system.
I tried to add <Reference Include="mscorlib" /> to the project file, but this did not resolve the issue.
I use VS 2017.
Will appreciate any clue.
Thank you #Abhitej, for the answer. It resolved the issue. In addition to switching to higher version of framework I added tags like <Remove FullName="System.Security.Cryptography.CryptoStream"/> for each failing class to both ShimGeneration and StubGeneration in .fakes file.
In most cases like this one its tied to the version of .Net Framework installed on the box. As long as your test project targets the highest version of the Framework on your box, this should work out. Also when dealing with System* namespace please be sure to only generate fakes for types you need excluding others. That should help Fakes deal with API changes over versions and resolve any build errors you might be seeing because of this.
-Abhitej.

Could not load file or assembly 'EntityFramework' error

Could not load file or assembly 'EntityFramework, Version=4.3.1.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I only get this error when I add this code into my project:
private IUserRepository repository;
public SearchController(IUserRepository repo)
{
repository = repo;
}
I suppose that makes sense as I'm using EntityFramework for this. I'm just now sure how to fix this bug.
I've looked at this link: http://msdn.microsoft.com/en-us/library/e74a18c4.aspx
Though I'm not sure how to use this program? (It's always blank).
I think that this bug may have something to do with the fact that my database is hosted by dotnet-host.com and that there's some local references that break when it interacts with the database online.
What the error is telling you is that your project referenced a different version of EntityFramework.dll than it found at runtime.
Check which version of EntityFramework.dll did you reference in your project (update your question).
Make sure you copy all the relevant dll and *.manifest into application's bin folder.
Since It's an external host, You might need to install the EntityFramework through WebMatrix Package Manager. If you do, you can follow this tutorial.
Just make sure to install the same version of EntityFramework on your host site that you use for development, or
change your assembly reference to Specific Version = false on EntityFramework dlls (Note I'm not sure if it will work, because I always try to develop and deploy using the same versions, so maybe somebody can confirm?).

PortableLibrary Could not load file or assembly

I have asp.net 4 webforms website which references PortableLibrary project. In the website I serialize classes from PortableLibrary. When I deployed the project to webserver machine with IIS6 I'm getting following error:
Could not load file or assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
the portable library project references System.Xml (v4.0.31029).
When I tried to deploy clean project without references, just with simple serialization of string object, it worked fine.
A tried assemblybinding in web config but without success.
Why I'm getting this error? I have no idea from where comes the '2.0.5.0' version of system.xml.
answer from here: http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981
which worked for me
We'll have clearer docs around this when we release, however, you need to have Update for Microsoft .NET Framework (KB2468871)[1] installed on the web server. You will also need to remove the the binding redirect - this will actually have the reverse effect of disabling the feature. :) [1] http://www.microsoft.com/downloads/en/details.aspx?FamilyID=41bdce1f-3cb3-44bb-9b33-23a1b8c99ac3&displaylang=en

WatiN Error Could not Load Assembly

I am getting the following WatiN error:
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembl y 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=db7cfd3acb5 ad44e' or one of its dependencies. The
located assembly's manifest definition do es not match the assembly
reference. (Exception from HRESULT: 0x80131040) File name:
'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db
I copied the shDocvw.dll from System32 to the bin directory but still it is giving me the same problems.
If you've installed and referenced WatiN using NuGet in VS2010, you should already have the correct references, so they don't need to be removed and re-added. But you will still need to change the "Embed Interop Types" setting to False on the Interop.SHDocVw reference.
UPDATE: This answer was written before Nuget was released and applies only if you are NOT using Nuget to manage your dependencies. If you are using Nuget see the answer by #Nick Jones
I just had this issue today. You need to download the latest version of WatiN (I'm using 2.0.10.928) and reference the signed Interop.SHDocVw.dll that is provided by WatiN.
Try the follwoing:
Remove all other References to Interop.SHDocVw.dll
Right Click your solution and select 'Clean Solution'
Reference the Interop.SHDocVw.dll that is provided by WatiN
Build your solution.
Hope this helps.
UPDATE: Nick Jones is correct. This should not be an issue if you are using NuGet....but I was also getting this message when using MvcContrib.Mvc3.TestHelper-ci. At first glance it seems like the '-ci' packages is the way to go but I decided to use the MvcContrib.WatiN package for two reasons.
1) I don't get the "Could not load file or assembly" error message
2) The MvcContrib.Mvc3.TestHelper-ci is using an old version of WatiN.Core.dll (1.3.0.4000) where as the MvcContrib.WatiN package is using a newer version (2.0.0.99)
Check out the Properties of the Reference "Interop.SHDocVw.dll". Change the "Embed Interop Types" to False.
The problem is that it is not copying the dll file in your bin folder. But after this setting, it will do it properly.
I had the same error, and now its working fine.

Resources