@@ -91,7 +91,7 @@ private async IAsyncEnumerable<DiscoveryResult> FindAllSolutionsAndProjects(stri
9191 return null ;
9292
9393 // Check for the project/solution to test with was found
94- FindProjectOrSolution ( rootDir , itemPath , out string ? project , out int countOfSln , out int countOfProjs , out int countOfCode , out int countOfSpecial , ref projectsFound ) ;
94+ FindProjectOrSolution ( rootDir , itemPath , itemWasDeleted , out string ? project , out int countOfSln , out int countOfProjs , out int countOfCode , out int countOfSpecial , ref projectsFound ) ;
9595
9696 // If it's a solution file, check that all the projects are referenced in it:
9797 if ( countOfSln == 1 )
@@ -134,7 +134,7 @@ private async IAsyncEnumerable<DiscoveryResult> FindAllSolutionsAndProjects(stri
134134 } ;
135135 }
136136
137- static void FindProjectOrSolution ( string rootDir , string itemDirectory , out string ? project , out int countOfSln , out int countOfProjs , out int countOfCode , out int countOfSpecial , ref List < string > projectsFound )
137+ static void FindProjectOrSolution ( string rootDir , string itemDirectory , bool isDeleted , out string ? project , out int countOfSln , out int countOfProjs , out int countOfCode , out int countOfSpecial , ref List < string > projectsFound )
138138 {
139139 project = null ;
140140 countOfSln = 0 ;
@@ -146,7 +146,8 @@ static void FindProjectOrSolution(string rootDir, string itemDirectory, out stri
146146 // If a file is deleted, and no other content is there, the directory won't exist
147147 if ( Directory . Exists ( itemDirectory ) )
148148 {
149- foreach ( var file in Directory . EnumerateFiles ( itemDirectory , $ "*.*", SearchOption . AllDirectories ) )
149+ // If the item is deleted, we don't need to scan it, but we do need to scan the parents
150+ foreach ( var file in Directory . EnumerateFiles ( itemDirectory , $ "*.*", isDeleted ? SearchOption . TopDirectoryOnly : SearchOption . AllDirectories ) )
150151 ScanFile ( file , ref project , ref countOfSln , ref countOfProjs , ref countOfCode , ref countOfSpecial , ref projectsFound ) ;
151152 }
152153
0 commit comments