Skip to content

Conversation

@xtqqczze
Copy link
Contributor

No description provided.

Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use one PR per change.

// The drive pointing to VHD in session 'B' gets detected as DriveType.NoRootDirectory
// after the VHD is removed in session 'A'.
if (drive != null && !string.IsNullOrEmpty(drive.Name) && drive.Name.Length == 1)
if (drive is { Name.Length: 1 })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to avoid using patterns since we haven't nullability check enabled.
I guess something classic like drive?.Name?.Length == 1 would work here.

if (char.IsAsciiLetterUpper((char)c))
{
c = (char) (c | 0x20);
c |= 0x20;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't check non-compiled code.

}

return isSupportedDriveForPersistence;
return drive is { Name.Length: 1 } && char.IsAsciiLetter(drive.Name[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same about pattern.

// To match old behavior we'll check the drive character for validity as the path is technically
// not qualified if you don't have a valid drive. "=:\" is the "=" file's default data stream.
&& IsValidDriveChar(path[0]));
&& char.IsAsciiLetter(path[0]));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep old method name for readability but update implementation.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants