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

Concurrent tool execution results in IOException when acquiring temporary path #114

Open
Valdiralita opened this issue Jul 30, 2021 · 1 comment

Comments

@Valdiralita
Copy link

Valdiralita commented Jul 30, 2021

We have a visual studio solution containing multiple csharp projects, each project has a t4 tool running on build.
Sometimes when building the solution we get the following error.
Maybe running multiple t4 instances at the same time has some issues generating unique temp paths.

53>Target DotnetToolRestore:
53>  Tool 'dotnet-t4' (version '2.2.1') was restored. Available commands: t4
53>Target T4Generate:
53>  System.IO.IOException: Cannot create 'C:\Users\USER\AppData\Local\Temp\tmp749B.tmp' because a file or directory with the same name already exists.
53>     at System.IO.FileSystem.CreateDirectory(String fullPath, Byte[] securityDescriptor)
53>     at System.IO.Directory.CreateDirectory(String path)
53>     at Mono.TextTemplating.TemplatingEngine.CompileCode(IEnumerable`1 references, TemplateSettings settings, CodeCompileUnit ccu) in D:\a\t4\t4\Mono.TextTemplating\Mono.TextTemplating\TemplatingEngine.cs:line 241
53>     at Mono.TextTemplating.TemplatingEngine.CompileTemplateInternal(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings) in D:\a\t4\t4\Mono.TextTemplating\Mono.TextTemplating\TemplatingEngine.cs:line 204
53>     at Mono.TextTemplating.TemplatingEngine.CompileTemplate(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings) in D:\a\t4\t4\Mono.TextTemplating\Mono.TextTemplating\TemplatingEngine.cs:line 174
53>     at Mono.TextTemplating.ToolTemplateGenerator.ProcessTemplate(ParsedTemplate pt, String inputFile, String inputContent, String& outputFile, TemplateSettings settings) in D:\a\t4\t4\dotnet-t4\ToolTemplateGenerator.cs:line 64
53>     at Mono.TextTemplating.TextTransform.MainInternal(String[] args) in D:\a\t4\t4\dotnet-t4\TextTransform.cs:line 218
53>     at Mono.TextTemplating.TextTransform.Main(String[] args) in D:\a\t4\t4\dotnet-t4\TextTransform.cs:line 42
53>  C:\CodeBase\ProjectName\ProjectName.csproj(43,5): error MSB3073: The command "dotnet tool run t4 -- generator.t4 -o OutputFIle.gen.cs" exited with code -1.
@mhutch
Copy link
Member

mhutch commented Aug 25, 2021

This is fixed by 0c09928, but I haven't released it yet as it's intertwined with 89a98f8, which breaks assembly unload.

FWIW, all the most recent packages in GPR came from the MSBuild targets branch (PR #110), which does include the above commits and a fix for the unload issue.

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

2 participants