From adde95d7a1cf66275444c67c600e596f0d819bb3 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 21 Nov 2023 13:24:36 +0000 Subject: [PATCH] C#: Tolerate missing solution files in tests --- csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs b/csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs index d48cfa15913..caddda4bb26 100644 --- a/csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs +++ b/csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs @@ -61,6 +61,12 @@ namespace Semmle.Autobuild.Shared { try { + // SolutionFile.Parse won't throw a FileNotFoundException if it is given a Windows path on a non-Windows platform + if (!builder.Actions.FileExists(FullPath)) + { + throw new FileNotFoundException(FullPath); + } + solution = SolutionFile.Parse(FullPath); } catch (Exception ex) when (ex is InvalidProjectFileException || ex is FileNotFoundException)