Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
#if !NETFRAMEWORK
Expand Down Expand Up @@ -251,7 +252,7 @@ public static void Unmount(string mountPoint)

bool r = DeleteVolumeMountPoint(mountPoint);
if (!r)
throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastWin32Error()));
throw new Win32Exception(Marshal.GetLastWin32Error());
}

private static ProcessStartInfo CreateProcessStartInfo(string fileName, params string[] arguments)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Text;
using Xunit;
using Microsoft.DotNet.XUnitExtensions;
Expand Down Expand Up @@ -82,7 +83,8 @@ public void Delete_VolumeMountPoint()
{
if (Directory.Exists(mountPoint))
{
MountHelper.Unmount(mountPoint);
try { MountHelper.Unmount(mountPoint); }
catch (Win32Exception ex) when (ex.NativeErrorCode is 4390 or 3) { }
Directory.Delete(mountPoint);
}
}
Expand Down
Loading
Loading