[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)
|
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);
|
resource = resource.Replace ('\\', zipDirectorySeparator);
|
||||||
var entry = archive.GetEntry (resource);
|
var entry = archive.GetEntry (resource);
|
||||||
if (entry is null) {
|
if (entry is null) {
|
||||||
|
@ -165,7 +165,7 @@ namespace Xamarin.MacDev {
|
||||||
resource = resource.Replace ('\\', zipDirectorySeparator);
|
resource = resource.Replace ('\\', zipDirectorySeparator);
|
||||||
var resourceAsDir = resource + zipDirectorySeparator;
|
var resourceAsDir = resource + zipDirectorySeparator;
|
||||||
|
|
||||||
var archive = ZipFile.OpenRead (zip);
|
using var archive = ZipFile.OpenRead (zip);
|
||||||
foreach (var entry in archive.Entries) {
|
foreach (var entry in archive.Entries) {
|
||||||
var entryPath = entry.FullName;
|
var entryPath = entry.FullName;
|
||||||
if (entryPath.Length == 0)
|
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)
|
static bool TryGetInfoPlist (TaskLoggingHelper log, string resourcePath, string xcframework, [NotNullWhen (true)] out PDictionary? plist)
|
||||||
{
|
{
|
||||||
var manifestPath = Path.Combine (xcframework, "Info.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) {
|
if (stream is null) {
|
||||||
plist = null;
|
plist = null;
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче