getgauge / gauge-csharp

Csharp runner for Gauge
https://gauge.org
GNU General Public License v3.0
33 stars 21 forks source link

Error on compiling #152

Closed jmsvl closed 5 years ago

jmsvl commented 5 years ago

I'm getting the following error when running the tests generated by "gauge init csharp". Any help?

Building project: F:/MLKPackages/9.2.18/tests-demo/TestsDemo.csproj c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe F:/MLKPackages/9.2.18/tests-demo/TestsDemo.csproj /t:Build /m /nodeReuse:False /v:q /p:RestorePackages="False" /p:OutputPath="F:\MLKPackages\9.2.18\tests-demo\gauge_bin" /p:P latform="Any CPU" /p:Configuration="Debug" /logger:Fake.MsBuildLogger+ErrorLogger,"C:\Users\jorge.lourenco\AppData\Roami ng\gauge\plugins\csharp\0.10.5\bin\FakeLib.dll" Microsoft (R) Build Engine version 4.6.1590.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pac k installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of ref erence assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [F:\MLKPackages\9 .2.18\tests-demo\TestsDemo.csproj] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch be tween the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\W indows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please conside r changing the targeted processor architecture of your project through the Configuration Manager so as to align the proc essor architectures between your project and references, or take a dependency on references with a processor architectur e that matches the targeted processor architecture of your project. [F:\MLKPackages\9.2.18\tests-demo\TestsDemo.csproj] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch be tween the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Syst em.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architectur e of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor archite cture of your project. [F:\MLKPackages\9.2.18\tests-demo\TestsDemo.csproj] Gauge.CSharp.Runner.SandboxBuilder Unable to create Sandbox in F:\MLKPackages\9.2.18\tests-demo\gauge_bin

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocati on. ---> System.BadImageFormatException: Could not load file or assembly 'file:///F:\MLKPackages\9.2.18\tests-demo\gauge _bin\mscorlib.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Runtim eAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro spection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, Ru ntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn trospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValu e, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackM ark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at Gauge.CSharp.Runner.Wrappers.AssemblyWrapper.LoadFrom(String location) in C:\Program Files (x86)\Go Agent\pipeline s\Csharp-Package\Runner\Wrappers\AssemblyWrapper.cs:line 26 at Gauge.CSharp.Runner.AssemblyLoader.ScanAndLoad(String path) in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Pa ckage\Runner\AssemblyLoader.cs:line 148 at Gauge.CSharp.Runner.AssemblyLoader..ctor(String runnerBasePath, IAssemblyWrapper assemblyWrapper, IFileWrapper fil eWrapper, IEnumerable1 assemblyLocations) in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Package\Runner\AssemblyLo ader.cs:line 93 at Gauge.CSharp.Runner.AssemblyLoader..ctor(String runnerBasePath, IEnumerable1 assemblyLocations) in C:\Program Fil es (x86)\Go Agent\pipelines\Csharp-Package\Runner\AssemblyLoader.cs:line 100 at Gauge.CSharp.Runner.Sandbox..ctor(String runnerBasePath) in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Packa ge\Runner\Sandbox.cs:line 60 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, Cultu reInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo cul ture, Object[] activationAttributes) at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlag s bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlag s bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at Gauge.CSharp.Runner.SandboxBuilder.Build() in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Package\Runner\Sand boxBuilder.cs:line 59 at Gauge.CSharp.Runner.StartCommand.<>c.<.ctor>b__3_0() in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Package\R unner\StartCommand.cs:line 34 at Gauge.CSharp.Runner.StartCommand.Execute() in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Package\Runner\Star tCommand.cs:line 58 at Gauge.CSharp.Runner.Program.Main(String[] args) in C:\Program Files (x86)\Go Agent\pipelines\Csharp-Package\Runner \Program.cs:line 38 Error ----------------------------------

Failed to start gauge API: Runner with pid 5684 quit unexpectedly(exit status 3762504530).

Get Support ---------------------------- Docs: https://docs.gauge.org Bugs: https://github.com/getgauge/gauge/issues Chat: https://gitter.im/getgauge/chat

Your Environment Information ----------- windows, 1.0.3, ff6c0c3 csharp (0.10.5), html-report (4.0.6), screenshot (0.0.1), xml-report (0.2.0)

BugDiver commented 5 years ago

@jmsvl Could you give us some more information like

jmsvl commented 5 years ago

Sorry for the delay. Below is the info you asked for:

Plugins

csharp (0.10.5) html-report (4.0.6) screenshot (0.0.1) xml-report (0.2.0)

Will this be enough?

Thanks

sriv commented 5 years ago

hi @jmsvl - shooting in the dark, but is your directory a network drive, by any chance? i.e. is your F drive mapped to a network?

jmsvl commented 5 years ago

No, it's a local drive on the server

On Thu, Dec 6, 2018, 01:49 Srikanth <notifications@github.com wrote:

hi @jmsvl https://github.com/jmsvl - shooting in the dark, but is your directory a network drive, by any chance? i.e. is your F drive mapped to a network?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getgauge/gauge-csharp/issues/152#issuecomment-444718696, or mute the thread https://github.com/notifications/unsubscribe-auth/AGnnXLNcyDm5i4k3NaLpYH_wXt_38SjGks5u2HeygaJpZM4Y4F8s .

jmsvl commented 5 years ago

Any breakthrough?

sriv commented 5 years ago

I don't have access to windows server 2012, the closest I could get is a windowsservercore docker image and a windows 10 VM.

I could not replicate your issue on either.

jmsvl commented 5 years ago

I suspect the problem can be the MSBuild version that's installed. What are the requirements in terms of .Net Framework version and MSBuild?

Thanks

On Thu, Dec 20, 2018 at 5:14 AM Srikanth notifications@github.com wrote:

I don't have access to windows server 2012, the closest I could get is a windowsservercore docker image and a windows 10 VM.

I could not replicate your issue on either.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getgauge/gauge-csharp/issues/152#issuecomment-448876742, or mute the thread https://github.com/notifications/unsubscribe-auth/AGnnXJOIfHfUYsSLV35eZLPKPIx5oHpYks5u6xzLgaJpZM4Y4F8s .

sriv commented 5 years ago

.NET framework 4.5 + should be good enough. Its been a while I've used this with MSBuild 4.0, MSBuild 14.0 or 15.0 should be good, I guess.

Is your machine on-premise or do you see this in any cloud VM?

Thanks.

jmsvl commented 5 years ago

It's a cloud VM, yes

sriv commented 5 years ago

If there's a way I can replicate the setup (if you have shareable provisioning code/templates), that will be super helpful to troubleshoot. Thanks.

jmsvl commented 5 years ago

I finally got it to work after reinstalling the .Net 4.5.1 framework on the server. Initially I was using dotnet core plugin to run the tests and I was getting several timeouts so I switched to csharp plugin and uninstalled the DotNet Core Runtime from the server. That was probably the cause for this strange errors.

Thank you for your help

On Thu, Dec 20, 2018 at 10:57 AM Srikanth notifications@github.com wrote:

If there's a way I can replicate the setup (if you have shareable provisioning code/templates), that will be super helpful to troubleshoot. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getgauge/gauge-csharp/issues/152#issuecomment-448956646, or mute the thread https://github.com/notifications/unsubscribe-auth/AGnnXEC1G8u3fk5NTW9TJV5eLyrIon8fks5u620TgaJpZM4Y4F8s .

sriv commented 5 years ago

Glad to hear things have fallen in place @jmsvl. You're welcome.

Closing this issue, feel free to ask more here or at the gitter chat.