Skip to content

Commit

Permalink
Add STATUS_VHD_INVALID_STATE handling on getting volume information
Browse files Browse the repository at this point in the history
Fix for stack trace of:

```
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Artifacts.FileSystem' threw an exception. ---> System.ComponentModel.Win32Exception: rFailed retrieving volume information fo \\?\Volume{guid}\\ with winerror -1069940708
   at Microsoft.CopyOnWrite.Windows.NativeMethods.ThrowSpecificIoException(Int32 lastErr, String message) in D:\CoW\lib\Windows\NativeMethods.cs:line 30
   at Microsoft.CopyOnWrite.Windows.VolumeInfoCache.GetVolumeInfo(VolumePaths volumePaths) in D:\CoW\lib\Windows\VolumeInfoCache.cs:line 161
```
  • Loading branch information
stan-sz committed Nov 4, 2024
1 parent ee6df59 commit 3bf58c6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PropertyGroup>

<!-- DOCSYNC: When changing version number update README.md -->
<Version>0.4.1</Version>
<Version>0.4.2</Version>
<AssemblyVersion>0.9.9999.0</AssemblyVersion>

<Company>Microsoft</Company>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ File clones on Windows do not actually allocate space on-drive for the clone. Th

[![NuGet version (CopyOnWrite)](https://img.shields.io/nuget/v/CopyOnWrite?style=plastic)](https://www.nuget.org/packages/CopyOnWrite)

* 0.4.2 November 2024: Add STATUS_VHD_INVALID_STATE handling on getting volume information
* 0.4.1 October 2024: Add ERROR_DEV_NOT_EXIST handling on volume enumeration
* 0.4.0 October 2024: Remove async versions of `CloneFile` as the implementation did not use overlapped I/O anyway. CoW support is releasing in the Server 2025 and Win11 24H2 wave, built into the `CopyFile` API suite and on by default for Dev Drive and ReFS, so overlapped I/O in this library will never be implemented. Resolves https://github.com/microsoft/CopyOnWrite/issues/50
* 0.3.12 October 2024: Add ERROR_DEV_NOT_EXIST handling on getting free disk space
Expand Down
1 change: 1 addition & 0 deletions lib/Windows/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public enum FileSystemFeature : uint
public const int ERROR_DEV_NOT_EXIST = 55;
public const int ERROR_MORE_DATA = 234;
public const int ERROR_NO_SUCH_DEVICE = 433;
public const int STATUS_VHD_INVALID_STATE = unchecked((int)0xC03A001C);

// ReFS specific WinError codes.
public const int ERROR_BLOCK_TOO_MANY_REFERENCES = 347;
Expand Down
3 changes: 2 additions & 1 deletion lib/Windows/VolumeInfoCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public VolumeInfo GetVolumeForPath(string path)
lastErr == FVE_E_LOCKED_VOLUME ||
lastErr == NativeMethods.ERROR_ACCESS_DENIED ||
lastErr == NativeMethods.ERROR_FILE_NOT_FOUND ||
lastErr == NativeMethods.ERROR_DEV_NOT_EXIST)
lastErr == NativeMethods.ERROR_DEV_NOT_EXIST ||
lastErr == NativeMethods.STATUS_VHD_INVALID_STATE)
{
return null;
}
Expand Down

0 comments on commit 3bf58c6

Please sign in to comment.