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

Transform fails when project is targetting multiple frameworks #290

Open
CraigRichards opened this issue Jan 23, 2024 · 2 comments
Open

Comments

@CraigRichards
Copy link

Hi,
I regularly target multiple frameworks in the work I do and this constantly fails due to file-locking issues. I love this product and hope you can patch this easily.

Reproduction is simple.
I target multiple frameworks as the API client should work for all framework versions and my tests required different configurations depending on the environment. net4;net45;net451;net452;net461;net462;net47;net471;net472;net48;netcoreapp3.0;netcoreapp3.1;net5;net6;net7

image

Error Message

Severity Code Description Project File Line Suppression State
Error MSB4018 The "SlowCheetah.TransformTask" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'd:\Api.Client.Tests\appSettings.Dev3.json' because it is being used by another process.
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)
at Microsoft.VisualStudio.Jdt.JsonTransformation..ctor(String transformFile, IJsonTransformationLogger logger)
at Microsoft.VisualStudio.SlowCheetah.JsonTransformer.Transform(String sourcePath, String transformPath, String destinationPath)
at Microsoft.VisualStudio.SlowCheetah.TransformTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Api.Client.Tests D:\licensing-api\packages-cache\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets 115

@KalleOlaviNiemitalo
Copy link

That's caused by a bug in another repository microsoft/json-document-transforms#21

https://github.com/microsoft/json-document-transforms/blob/36334de591fb5db86dcbd50500b3517ac4610422/src/Microsoft.VisualStudio.Jdt/JsonTransformation.cs#L44

It calls File.Open(transformFile, FileMode.Open, FileAccess.Read), which uses FileShare.None by default, thus does not allow anything else to read the same file at the same time. Should preferably just call File.OpenRead(transformFile), or alternatively specify FileShare.Read explicitly.

@mwpowellhtx
Copy link

I'm running into a similar issue, my targets are not running properly, like none whatsoever, seems like, under multi-targeting scenarios. Turns out, may be an issue with how NuGet is now treating build/ and buildMultiTargeting/, .props and .targets consumption. It is something probably, more than likely, new, since the time of during which these packages had last published. That's my two cents for what it's worth. I am working to resolve just that matter right now, in my packages.

ttstanley pushed a commit that referenced this issue Nov 14, 2024
Bumps [xunit](https://github.com/xunit/xunit) from 2.9.0 to 2.9.1.
- [Commits](xunit/xunit@2.9.0...2.9.1)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants