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

Fix temp directory access when signing in parallel #98

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Brutal.Dev.StrongNameSigner.Tests/SignAssemblyTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Shouldly;
using Xunit;

Expand Down Expand Up @@ -264,5 +265,14 @@ public void SignAssembly_InPlaceWithoutPdb_Should_Succeed()
Directory.Delete(tempDir, true);
}
}

[Fact]
public void SignAssembly_InParralel_Should_Succeed()
{
Parallel.Invoke(
SignAssembly_Public_API_Test,
SignAssembly_Should_Reassemble_NET_45_Assembly_Correctly
);
}
}
}
2 changes: 1 addition & 1 deletion src/Brutal.Dev.StrongNameSigner/SigningHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static void SignAssemblies(IEnumerable<InputOutputFilePair> assemblyInput

// File locking issues in Mono.Cecil are a real pain in the ass so let's create a working directory of files to process, then copy them back when we're done.
var tempFilePathToInputOutputFilePairMap = new Dictionary<string, InputOutputFilePair>();
var tempPath = Path.Combine(Path.GetTempPath(), "StrongNameSigner");
var tempPath = Path.Combine(Path.GetTempPath(), "StrongNameSigner-" + Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);

foreach (var inputOutpuFilePair in assemblyInputOutputPaths)
Expand Down