Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find-Match crashes if Onedrive synced file is missing on harddisk - Find-Match : Cannot convert value "4199968" to type "VstsTaskSdk.FS.Attributes" due to enumeration values that are not valid. Specify one of the following enumeration values and try again. #996

Closed
jessehouwing opened this issue Nov 17, 2023 · 1 comment · Fixed by #805
Assignees

Comments

@jessehouwing
Copy link
Contributor

From #763:

Environment

azure-pipelines-task-lib version: 0.11.0

Issue Description

Find-Match crashes if Onedrive synced file is missing on harddisk

Expected behaviour

Find-Match is working properly

Actual behaviour

Find-Match : Cannot convert value "4199968" to type "VstsTaskSdk.FS.Attributes" due to enumeration values that are not valid. Specify one of the following enumeration values and try again. The possible enumeration values are "None,Readonly,Hidden,System,Directory,Archive,Device,Normal,Temporary,SparseFile,ReparsePoint,Compressed,Offline,NotContentIndexed,Encrypted,IntegrityStream,Virtual, NoScrubData,FirstPipeInstance,OpenNoRecall,OpenReparsePoint,PosixSemantics,BackupSemantics,DeleteOnClose,SequentialScan,RandomAccess,NoBuffering,Overlapped,Write_Through".

Steps to reproduce

  1. Install Onedrive
  2. Sync a file to the cloud
  3. remove the local copy
  4. try to find the file via Find-Match

The file https://github.com/microsoft/azure-pipelines-task-lib/blob/21dac986b4c7478eb2ed8ffbd60e4fad62904438/powershell/CompiledHelpers/VstsTaskSdk.cs contains the enum Attributes

The constants: FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 4194304 (0x400000) and FILE_ATTRIBUTE_RECALL_ON_OPEN 262144 (0x40000) are missing.

That's the reason why this cast failes: $attributes = [VstsTaskSdk.FS.Attributes]$findData.fileAttributes

see https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants?redirectedfrom=MSDN

After adding the two constants to the enum Find-Match is working properly

Fixed by: #805

@DenisRumyantsev
Copy link
Contributor

@jessehouwing thank you for the PR, let us review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants