Skip to content

Commit 41d093d

Browse files
Fix Windows CI file locking race in CSharp test runner
Add /p:UseSharedCompilation=false to disable VBCSCompiler server and /p:CopyRetryCount=3 /p:CopyRetryDelayMilliseconds=500 for retry logic on both dotnet build invocations. Addresses System.IO.IOException on Antlr4.Runtime.Standard.deps.json during parallel test execution.
1 parent 04b642a commit 41d093d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/CSharpRunner.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ protected void initRuntime(RunOptions runOptions) throws Exception {
4848
String cachePath = getCachePath();
4949
mkdir(cachePath);
5050
String projectPath = Paths.get(getRuntimePath(), "src", "Antlr4.csproj").toString();
51-
String[] args = new String[]{getRuntimeToolPath(), "build", projectPath, "-c", "Release", "-o", cachePath};
51+
String[] args = new String[]{getRuntimeToolPath(), "build", projectPath, "-c", "Release", "-o", cachePath,
52+
"/p:UseSharedCompilation=false", "/p:CopyRetryCount=3", "/p:CopyRetryDelayMilliseconds=500"};
5253
runCommand(args, cachePath, "build " + getTitleName() + " ANTLR runtime");
5354
}
5455

@@ -57,7 +58,8 @@ public CompiledState compile(RunOptions runOptions, GeneratedState generatedStat
5758
Exception exception = null;
5859
try {
5960
writeFile(getTempDirPath(), testProjectFileName, cSharpTestProjectContent);
60-
runCommand(new String[]{getRuntimeToolPath(), "build", testProjectFileName, "-c", "Release"}, getTempDirPath(),
61+
runCommand(new String[]{getRuntimeToolPath(), "build", testProjectFileName, "-c", "Release",
62+
"/p:UseSharedCompilation=false", "/p:CopyRetryCount=3", "/p:CopyRetryDelayMilliseconds=500"}, getTempDirPath(),
6163
"build C# test binary");
6264
} catch (Exception e) {
6365
exception = e;

0 commit comments

Comments
 (0)