Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.BadImageFormatException #50

Open
bmccabe opened this issue Aug 15, 2019 · 4 comments
Open

System.BadImageFormatException #50

bmccabe opened this issue Aug 15, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@bmccabe
Copy link

bmccabe commented Aug 15, 2019

Since the last update I'm getting this when I do a build. If I try to generate step definitions I get told that all steps are bound. If I switch back to SpecFlow I don't get the error.


Info: OnActivityStarted: Starting Deveroom...
Info: CreateProjectScope: Initializing project: Featuretests2
Info: OnSettingsInitialized: Project settings initialized: .NETFramework,Version=v4.7.1,SpecFlow:3.0.225
Warning: InvokeDiscovery: Error during binding discovery. 
Command executed:
  C:\Users\robertm\source\repos\WindowsFormsApp4\UnitTestProject2\bin\Debug> c:\users\robertm\appdata\local\microsoft\visualstudio\15.0_8984b99c\extensions\4v220uaj.2mr\Connectors\V1\deveroom-specflow-v1.exe discovery C:\Users\robertm\source\repos\WindowsFormsApp4\UnitTestProject2\bin\Debug\FeatureTests2.dll C:\Users\robertm\source\repos\WindowsFormsApp4\UnitTestProject2\App.config
Exit code: 4
Message: 
Error: Could not load file or assembly 'file:///C:\Users\robertm\source\repos\WindowsFormsApp4\UnitTestProject2\bin\Debug\FeatureTests2.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Exception: System.BadImageFormatException
StackTrace:

Server stack trace: 
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Deveroom.VisualStudio.SpecFlowConnector.Discovery.RemotingBaseDiscoverer.Discover(String testAssemblyPath, String configFilePath)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Deveroom.VisualStudio.SpecFlowConnector.Discovery.IRemotingSpecFlowDiscoverer.Discover(String testAssembly, String configFilePath)
   at Deveroom.VisualStudio.SpecFlowConnector.Discovery.DiscoveryProcessor.Process()
   at Deveroom.VisualStudio.SpecFlowConnector.ConsoleRunner.EntryPoint(String[] args)

Warning: InvokeDiscovery: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled. 
  Please check the error message above and report to https://github.com/specsolutions/deveroom-visualstudio/issues if you cannot fix.
Warning: ShowProblem: User Notification: All steps have been defined in this file already.
@gasparnagy
Copy link
Contributor

Are any of your assemblies compiled to x32 or x64 (instead of AnyCPU)?

@bmccabe
Copy link
Author

bmccabe commented Aug 16, 2019 via email

@gasparnagy
Copy link
Contributor

Unfortunately this setting is not detected automatically yet. I believe by adding a file deveroom.json to your project root folder with the following content would help. Could you please try?

{
  "processorArchitecture": "X86"
}

@gasparnagy gasparnagy added the bug Something isn't working label Aug 16, 2019
@StefanZivkovic
Copy link

I am getting same error for Debug-x64, specflow 1.9.0, nUnit 2.6.2, Deveroom for SpecFlow, .Net4.7.2, and VS2019.

Server stack trace:
at Deveroom.VisualStudio.SpecFlowConnector.Discovery.BaseDiscoverer.DiscoverInternal(Assembly testAssembly, String testAssemblyPath, String configFilePath)
at Deveroom.VisualStudio.SpecFlowConnector.Discovery.RemotingBaseDiscoverer.Discover(String testAssemblyPath, String configFilePath)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Deveroom.VisualStudio.SpecFlowConnector.Discovery.IRemotingSpecFlowDiscoverer.Discover(String testAssembly, String configFilePath)
at Deveroom.VisualStudio.SpecFlowConnector.Discovery.DiscoveryProcessor.Process()
at Deveroom.VisualStudio.SpecFlowConnector.ConsoleRunner.EntryPoint(String[] args)

Warning: InvokeDiscovery: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled.
Please check the error message above and report to https://github.com/specsolutions/deveroom-visualstudio/issues if you cannot fix.

My steps in .feature file look good, but there is no connection with step implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants