Open gasparnagy opened 7 years ago
I was able to repro this issue by forcing a rebuild of project with a single scenario two times in a row when the project contains <SpecFlowEmbeddedFeature Include="**\*.feature" />
. It looks like the issue only occurs when the user is using a glob pattern but not ignoring files in the obj
directory. Changing the ItemGroup to <SpecFlowEmbeddedFeature Include="**\*.feature" Exclude="**\obj\**\*.feature;**\bin\**\*.feature" />
fixes this issue.
We should consider following the route Microsoft took with this and include a default ItemGroup for the user and allow them to opt out of it if they choose. Microsoft has a property called DefaultItemExcludes
that they use for their exclusion list.
It appears to be happening here: https://github.com/gasparnagy/SpecFlow.xUnitAdapter/blob/master/src/SpecFlow.xUnitAdapter.Build/SpecFlowSourceMapAppender.cs#L74
Versions Used:
Stack Trace:
Severity Code Description Project File Line Suppression State
Error The "SpecFlowSourceMapAppender" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow\obj\Debug\SpecFlow\SpecFlowFeature1.feature'.
File name: 'C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow\obj\Debug\SpecFlow\SpecFlowFeature1.feature'
Server stack trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at SpecFlow.xUnitAdapter.Build.SpecFlowSourceMapAppender.AppendSourceMap(ITaskItem item)
at SpecFlow.xUnitAdapter.Build.SpecFlowSourceMapAppender.Execute()
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 Microsoft.Build.Framework.ITask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() SpecFlowXunitTest
MSBuild Output:
1>------ Rebuild All started: Project: SpecFlowXunitTest, Configuration: Debug Any CPU ------
1>Build started 2017-10-13 12:23:17 PM.
1>Clean:
1> Removing directory "C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow".
1>SpecFlowFeatureSourceMapping:
1> Appending SpecFlow SourceMaps:
1> C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow\obj\Debug\SpecFlow\SpecFlowFeature1.feature
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: The "SpecFlowSourceMapAppender" task failed unexpectedly.
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: System.IO.FileNotFoundException: Could not find file 'C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow\SpecFlowFeature1.feature'.
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: File name: 'C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\SpecFlowXunitTest\obj\Debug\SpecFlow\SpecFlowFeature1.feature'
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018:
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: Server stack trace:
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at SpecFlow.xUnitAdapter.Build.SpecFlowSourceMapAppender.AppendSourceMap(ITaskItem item)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at SpecFlow.xUnitAdapter.Build.SpecFlowSourceMapAppender.Execute()
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018:
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: Exception rethrown at [0]:
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at Microsoft.Build.Framework.ITask.Execute()
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\chaws\documents\visual studio 2017\Projects\SpecFlowXunitTest\packages\SpecFlow.xUnitAdapter.1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(18,9): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Time Elapsed 00:00:00.091
@instecjason Can you verify that this is the same cause of your issue?
@ChristopherHaws that makes sense. Could you add this DefaultItemExcludes
to the targets file?
@instecjason Could you please confirm the workaround?
Sorry for the delayed response... Yes, that was the same cause as our problem.
I ran into this attempting to get this to work with the new style sdk proj files
A simple repro is here, just dotnet restore
, then dotnet build
, and the error should occur...
features.zip
@instecjason reported this issue as a follow up of #6