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

Access to the path 'filePath'.feature.cs is denied - error message after update to version 3.1.89 #1911

Closed
7 of 33 tasks
ZaPaw opened this issue Mar 17, 2020 · 14 comments
Closed
7 of 33 tasks

Comments

@ZaPaw
Copy link

ZaPaw commented Mar 17, 2020

SpecFlow Version:

  • 3.1
  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number:
NUnit 3.12.0
NUnit3TestAdapter 3.16.1

Project Format of the SpecFlow project

  • Classic project format using packages.config
  • Classic project format using <PackageReference> tags
  • Sdk-style project format

.feature.cs files are generated using

  • SpecFlow.Tools.MsBuild.Generation NuGet package
  • SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • VS 2019
  • VS 2017
  • VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • Enabled
  • Disabled

Are the latest Visual Studio updates installed?

  • Yes
  • No, I use Visual Studio version 15.9.18

.NET Framework:

  • >= .NET 4.5
  • before .NET 4.5
  • .NET Core 2.0
  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0

Test Execution Method:

  • Visual Studio Test Explorer
  • TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • Command line – PLEASE SPECIFY THE FULL COMMAND LINE

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


Repro Project

Issue Description

After update: SpecFlow, SpecFlow.Tools.MsBuild.Generation and SpecFlow.NUnit from version 3.1.86 to version 3.1.89, I get error when I try to Build project. On 3.1.86 version everything was ok.

Error message:
"Severity Code Description Project File Line Suppression State
Error [SpecFlow] System.UnauthorizedAccessException: Access to the path 'filePath.feature.cs' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
at System.IO.File.WriteAllText(String path, String contents)
at SpecFlow.Tools.MsBuild.Generation.CodeBehindWriter.WriteCodeBehindFile(String outputPath, String featureFile, TestFileGeneratorResult testFileGeneratorResult)
at SpecFlow.Tools.MsBuild.Generation.FeatureFileCodeBehindGenerator.d__6.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at SpecFlow.Tools.MsBuild.Generation.ProjectCodeBehindGenerator.GenerateCodeBehindFilesForProject()
at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute() TheNgWeb.UiTest D:\Product\packages\specflow.tools.msbuild.generation\3.1.89\build\SpecFlow.Tools.MsBuild.Generation.targets 93
"

Steps to Reproduce

Update: SpecFlow, SpecFlow.Tools.MsBuild.Generation and SpecFlow.NUnit from version 3.1.86 to version 3.1.89 in NuGet Package Manager in Visual Studio 2017.

@SabotageAndi
Copy link
Contributor

Is this on your local machine or on a build server?

@ZaPaw
Copy link
Author

ZaPaw commented Mar 17, 2020

On my local machine.

@SabotageAndi
Copy link
Contributor

I assume this is in Visual Studio.
Could you close it and compile your project on the command line?

I looked at the changes between 3.1.86 and 3.1.89 and there isn't anything about file access.

@SabotageAndi
Copy link
Contributor

Btw, which .NET Core SDK are you using? We have some problems with the new 3.1.200 Sdk ( #1912 )

@ZaPaw
Copy link
Author

ZaPaw commented Mar 17, 2020

Thank you for the quick response to this ticket.
.Net Core SDK version for my project is 2.1.509.
For compile project from command line -> I haven't got set up my enviroment for this. I will try and answer tomorrow.
Btw, This error appear on 2 difference machine but in the same project.

@ZaPaw
Copy link
Author

ZaPaw commented Mar 17, 2020

I compile project in command line using MSBuild and I get error:

Build FAILED.

".csproj" (default target) (1) ->
.csproj : error MSB4247: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path
'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017
\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll

0 Warning(s)
1 Error(s)

After change version to 3.1.86, build succeeded.

@SabotageAndi
Copy link
Contributor

and with a dotnet build?

@ZaPaw
Copy link
Author

ZaPaw commented Mar 23, 2020

Sorry for the long response time.

Can you explain to me what you mean by writing "and with a dotnet build" because I didn't get it?

For more information, this error is not related to new version. I get this error when I change some data in feature file too. For while change structure to be more flat ( shorter path) was solution but now I am still getting this error.

@SabotageAndi
Copy link
Contributor

You wrote that you used MSBuild to compile from commandline, so a msbuild call.
I suggested to change this to a dotnet build call.

@ZaPaw
Copy link
Author

ZaPaw commented Mar 24, 2020

After change to dotnet build I get Build FAILED message. Below I add screenshot.
Capture2

@SabotageAndi
Copy link
Contributor

@ZaPaw do you get this error?

@ZaPaw
Copy link
Author

ZaPaw commented Oct 30, 2020

@SabotageAndi for a long time I havn't got this error. But code had few refactors.

@SabotageAndi
Copy link
Contributor

Ok, then I am closing this issue.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants