From c2432f11ce6c3b287362fe28b99e9bcf5e932730 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Mon, 26 Feb 2018 09:33:16 -0800 Subject: [PATCH 1/2] Simplest change --- src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs b/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs index dfa6a62c0b..e476fc0bfb 100644 --- a/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs +++ b/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs @@ -595,7 +595,7 @@ private string[] GetFilesByAttributes(string directory, FileAttributes attribute IntPtr hFile = FindFirstFile(directory + "\\*", out findData); int error = Marshal.GetLastWin32Error(); - if (hFile.ToInt32() != -1) + if (handle != IntPtr.Zero && handle != new IntPtr(-1)) { do { From 1e4ae5f049fafacb121dc10cbc2b111ab264d3c9 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Mon, 26 Feb 2018 10:25:11 -0800 Subject: [PATCH 2/2] Typo --- src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs b/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs index e476fc0bfb..81d36f1f48 100644 --- a/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs +++ b/src/Microsoft.DotNet.Build.Tasks/CleanupVSTSAgent.cs @@ -595,7 +595,7 @@ private string[] GetFilesByAttributes(string directory, FileAttributes attribute IntPtr hFile = FindFirstFile(directory + "\\*", out findData); int error = Marshal.GetLastWin32Error(); - if (handle != IntPtr.Zero && handle != new IntPtr(-1)) + if (hFile != IntPtr.Zero && hFile != new IntPtr(-1)) { do {