Skip to content

Commit d3f47a2

Browse files
authored
[snippets] Add special exit for sln deleted (#353)
* Add special exit for sln deleted * Minor perf
1 parent cde6a70 commit d3f47a2

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

snippets5000/PullRequestSimulations/PullRequestSimulations.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

snippets5000/PullRequestSimulations/data.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,17 @@
216216
}
217217
]
218218
},
219+
{
220+
"Name": "Delete - SLN - Projects remain",
221+
"CountOfEmptyResults": 1,
222+
"ExpectedResults": null,
223+
"Items": [
224+
{
225+
"ItemType": "Delete",
226+
"Path": "snippets/good/normal/somefile.sln"
227+
}
228+
]
229+
},
219230
{
220231
"Name": "Create - New project, is in old solution",
221232
"ExpectedResults": [

snippets5000/Snippets5000/PullRequestProcessor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ private async IAsyncEnumerable<DiscoveryResult> FindAllSolutionsAndProjects(stri
8686
bool allProjectsFoundInSln = false;
8787
List<string> projectsFound = new List<string>();
8888

89+
// Special exit for solution deleted. Any artifacts left over should be caught by the other checks
90+
if (itemWasDeleted && Path.GetExtension(itemFileName).Equals(".sln", StringComparison.OrdinalIgnoreCase))
91+
return null;
92+
8993
// Check for the project/solution to test with was found
9094
FindProjectOrSolution(rootDir, itemPath, out string? project, out int countOfSln, out int countOfProjs, out int countOfCode, out int countOfSpecial, ref projectsFound);
9195

0 commit comments

Comments
 (0)