Skip to content

Commit eb228b6

Browse files
committed
C#: Address some review comments.
1 parent 62dd86b commit eb228b6

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public DependencyManager(string srcDir, IDependencyOptions options, ILogger logg
116116
if (options.ScanNetFrameworkDlls)
117117
{
118118
AddNetFrameworkDlls(dllPaths);
119-
AddAspNetFrameworkDlls(dllPaths);
119+
AddAspNetCoreFrameworkDlls(dllPaths);
120120
AddMicrosoftWindowsDesktopDlls(dllPaths);
121121
}
122122

@@ -247,14 +247,14 @@ private void AddNetFrameworkDlls(List<string> dllPaths)
247247
dllPaths.Add(runtimeLocation);
248248
}
249249

250-
private void AddAspNetFrameworkDlls(List<string> dllPaths)
250+
private void AddAspNetCoreFrameworkDlls(List<string> dllPaths)
251251
{
252252
if (!fileContent.IsNewProjectStructureUsed || !fileContent.UseAspNetCoreDlls)
253253
{
254254
return;
255255
}
256256

257-
// First try to find ASP.NET assemblies in the NuGet packages
257+
// First try to find ASP.NET Core assemblies in the NuGet packages
258258
if (GetPackageDirectory("microsoft.aspnetcore.app.ref") is string aspNetCorePackage)
259259
{
260260
progressMonitor.LogInfo($"Found ASP.NET Core in NuGet packages. Not adding installation directory.");
@@ -678,27 +678,25 @@ private void AnalyseSolutions(IEnumerable<string> solutions)
678678
});
679679
}
680680

681-
public void Dispose()
681+
public void Dispose(TemporaryDirectory? dir, string name)
682682
{
683683
try
684684
{
685-
packageDirectory?.Dispose();
686-
missingPackageDirectory?.Dispose();
685+
dir?.Dispose();
687686
}
688687
catch (Exception exc)
689688
{
690-
progressMonitor.LogInfo("Couldn't delete package directory: " + exc.Message);
689+
progressMonitor.LogInfo($"Couldn't delete {name} directory {exc.Message}");
691690
}
691+
}
692+
693+
public void Dispose()
694+
{
695+
Dispose(packageDirectory, "package");
696+
Dispose(missingPackageDirectory, "missing package");
692697
if (cleanupTempWorkingDirectory)
693698
{
694-
try
695-
{
696-
tempWorkingDirectory?.Dispose();
697-
}
698-
catch (Exception exc)
699-
{
700-
progressMonitor.LogInfo("Couldn't delete temporary working directory: " + exc.Message);
701-
}
699+
Dispose(tempWorkingDirectory, "temporary working");
702700
}
703701
}
704702
}

0 commit comments

Comments
 (0)