SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

Exception with MSBuild on Mono if flag maxCpuCount > 1 #2529

Closed zplan closed 2 years ago

zplan commented 2 years ago

SpecFlow Version

3.0.188

Which test runner are you using?

MSTest

Test Runner Version Number

2.2.7

.NET Implementation

equal or greater .NET Framework 4.6.1

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

SpecFlow Section in app.config or content of specflow.json

none (default)

Issue Description

OS: Debian Buster Mono JIT compiler version 6.10.0.104 Microsoft (R) Build Engine version 16.6.0 for Mono; 16.6.0

Building a solution with multiple projects only works when using 1 CPU

msbuild /m MyProject.sln --> fails msbuild MyProject.sln --> works

Steps to Reproduce

Create a solution with one specflow project and some other projects.

Build the solution on linux with mono:

msbuild /m MyProject.sln --> fails msbuild MyProject.sln --> works (but only uses 1 CPU)

Is is important to call msbuild with the sln file (with just the .csproj file it works)

The error message is excatly what we also see in the issue https://github.com/SpecFlowOSS/SpecFlow/issues/2325#issuecomment-864540824

/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: System.IO.IOException: Write fault on path /opt/home/Units/UnitTests/Specs/[Unknown] [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x0016b] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string) [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at System.Console.WriteLine (System.String value) [0x00000] in <a17fa1457c5d44f2885ac746c1764ea5>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at TechTalk.SpecFlow.Tracing.DefaultListener.WriteToolOutput (System.String message) [0x0000b] in <04a1e26c8778490c9fa206dac71c2cd7>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at TechTalk.SpecFlow.Configuration.ConfigurationLoader.TraceConfigSource (TechTalk.SpecFlow.Tracing.ITraceListener traceListener, TechTalk.SpecFlow.Configuration.SpecFlowConfiguration specFlowConfiguration) [0x0001b] in <04a1e26c8778490c9fa206dac71c2cd7>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer (TechTalk.SpecFlow.Generator.Interfaces.SpecFlowConfigurationHolder configurationHolder, TechTalk.SpecFlow.Generator.Interfaces.ProjectSettings projectSettings, System.Collections.Generic.IEnumerable`1[T] generatorPluginInfos, BoDi.IObjectContainer parentObjectContainer) [0x0012b] in <3314722a2b9e42de9952f0c08b785cff>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at SpecFlow.Tools.MsBuild.Generation.WrappedGeneratorContainerBuilder.BuildGeneratorContainer (TechTalk.SpecFlow.Generator.Interfaces.SpecFlowConfigurationHolder specFlowConfigurationHolder, TechTalk.SpecFlow.Generator.Interfaces.ProjectSettings projectSettings, System.Collections.Generic.IReadOnlyCollection`1[T] generatorPluginInfos, BoDi.IObjectContainer rootObjectContainer) [0x00000] in <9c686f92fcfa4fb390ecff0458a35e63>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute () [0x00049] in <9c686f92fcfa4fb390ecff0458a35e63>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute () [0x00122] in <9c686f92fcfa4fb390ecff0458a35e63>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <17ac7020b8724cc3ab2118010c2e573d>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]
/opt/home/Libraries/specflow.tools.msbuild.generation/3.9.40/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <17ac7020b8724cc3ab2118010c2e573d>:0  [/opt/home/Units/UnitTests/Specs/Specs.csproj]

Link to Repro Project

No response

SabotageAndi commented 2 years ago

Our MSBuild integration has some strange problems when running with Mono. Please use the dotnet tool to build it on Linux

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.