diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete_MountVolume.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete_MountVolume.cs index f4b153d94d9326..ed74831de984f6 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete_MountVolume.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete_MountVolume.cs @@ -79,8 +79,11 @@ public static void RunTest() } finally { - MountHelper.Unmount(mountedDirName); - DeleteDir(mountedDirName, true); + if (Directory.Exists(mountedDirName)) + { + MountHelper.Unmount(mountedDirName); + DeleteDir(mountedDirName, true); + } } File.AppendAllText(debugFileName, string.Format("Completed scenario {0}", Environment.NewLine)); } @@ -124,8 +127,11 @@ public static void RunTest() } finally { - MountHelper.Unmount(mountedDirName); - DeleteDir(mountedDirName, true); + if (Directory.Exists(mountedDirName)) + { + MountHelper.Unmount(mountedDirName); + DeleteDir(mountedDirName, true); + } } File.AppendAllText(debugFileName, string.Format("Completed scenario {0}", Environment.NewLine)); } @@ -166,8 +172,11 @@ public static void RunTest() } finally { - MountHelper.Unmount(mountedDirName); - DeleteDir(mountedDirName, true); + if (Directory.Exists(mountedDirName)) + { + MountHelper.Unmount(mountedDirName); + DeleteDir(mountedDirName, true); + } } File.AppendAllText(debugFileName, string.Format("Completed scenario {0}", Environment.NewLine)); } @@ -208,8 +217,11 @@ public static void RunTest() } finally { - MountHelper.Unmount(mountedDirName); - DeleteDir(mountedDirName, true); + if (Directory.Exists(mountedDirName)) + { + MountHelper.Unmount(mountedDirName); + DeleteDir(mountedDirName, true); + } } File.AppendAllText(debugFileName, string.Format("Completed scenario {0}", Environment.NewLine)); }