mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Do not throw exception when working directory cleanup fails
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
|
||||
/// <summary>
|
||||
/// The version number of the .NET Core framework that this assembly targets.
|
||||
///
|
||||
///
|
||||
/// This is extracted from the `TargetFrameworkAttribute` of the assembly, e.g.
|
||||
/// ```
|
||||
/// [assembly:TargetFramework(".NETCoreApp,Version=v7.0")]
|
||||
@@ -165,6 +165,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
unsafe
|
||||
{
|
||||
var reader = new MetadataReader(metadata.Pointer, metadata.Length);
|
||||
if (!reader.IsAssembly)
|
||||
{
|
||||
throw new AssemblyLoadException();
|
||||
}
|
||||
|
||||
var def = reader.GetAssemblyDefinition();
|
||||
|
||||
// This is how you compute the public key token from the full public key.
|
||||
|
||||
@@ -644,9 +644,25 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
packageDirectory?.Dispose();
|
||||
try
|
||||
{
|
||||
packageDirectory?.Dispose();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
progressMonitor.LogInfo("Couldn't delete package directory: " + exc.Message);
|
||||
}
|
||||
if (cleanupTempWorkingDirectory)
|
||||
tempWorkingDirectory?.Dispose();
|
||||
{
|
||||
try
|
||||
{
|
||||
tempWorkingDirectory?.Dispose();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
progressMonitor.LogInfo("Couldn't delete temporary working directory: " + exc.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user