Skip to content

Commit

Permalink
Do not throw exception when working directory cleanup fails
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasvajk committed Oct 11, 2023
1 parent 4f31b5a commit da09655
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal sealed partial class AssemblyInfo

/// <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")]
Expand Down Expand Up @@ -165,6 +165,11 @@ public static AssemblyInfo ReadFromFile(string filename)
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,25 @@ private void AnalyseSolutions(IEnumerable<string> solutions)

public void Dispose()
{
packageDirectory?.Dispose();
try
{
packageDirectory?.Dispose();
}
catch (Exception exc)
{
progressMonitor.LogInfo("Couldn't delete package directory: " + exc.Message);
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
if (cleanupTempWorkingDirectory)
tempWorkingDirectory?.Dispose();
{
try
{
tempWorkingDirectory?.Dispose();
}
catch (Exception exc)
{
progressMonitor.LogInfo("Couldn't delete temporary working directory: " + exc.Message);
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
}
}
}
}

0 comments on commit da09655

Please sign in to comment.