[msbuild] Dispose a few streams when done with them in the unzip/decompress logic. (#18410)
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1829715.
This commit is contained in:
Родитель
3feddf30eb
Коммит
50c5ae57f2
|
@ -130,7 +130,7 @@ namespace Xamarin.MacDev {
|
|||
|
||||
static bool TryDecompressUsingUnzip (TaskLoggingHelper log, string zip, string resource, string decompressionDir)
|
||||
{
|
||||
var archive = ZipFile.OpenRead (zip);
|
||||
using var archive = ZipFile.OpenRead (zip);
|
||||
resource = resource.Replace ('\\', zipDirectorySeparator);
|
||||
var entry = archive.GetEntry (resource);
|
||||
if (entry is null) {
|
||||
|
@ -165,7 +165,7 @@ namespace Xamarin.MacDev {
|
|||
resource = resource.Replace ('\\', zipDirectorySeparator);
|
||||
var resourceAsDir = resource + zipDirectorySeparator;
|
||||
|
||||
var archive = ZipFile.OpenRead (zip);
|
||||
using var archive = ZipFile.OpenRead (zip);
|
||||
foreach (var entry in archive.Entries) {
|
||||
var entryPath = entry.FullName;
|
||||
if (entryPath.Length == 0)
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
static bool TryGetInfoPlist (TaskLoggingHelper log, string resourcePath, string xcframework, [NotNullWhen (true)] out PDictionary? plist)
|
||||
{
|
||||
var manifestPath = Path.Combine (xcframework, "Info.plist");
|
||||
var stream = CompressionHelper.TryGetPotentiallyCompressedFile (log, resourcePath, manifestPath);
|
||||
using var stream = CompressionHelper.TryGetPotentiallyCompressedFile (log, resourcePath, manifestPath);
|
||||
if (stream is null) {
|
||||
plist = null;
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче