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. #763

Closed
ckrueger1979 opened this issue May 20, 2021 · 8 comments · Fixed by #805

Comments

@ckrueger1979
Copy link

ckrueger1979 commented May 20, 2021

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

@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Aug 19, 2021
@ckrueger1979
Copy link
Author

Issue is not fixed

@github-actions github-actions bot removed the stale label Aug 23, 2021
@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@ckrueger1979
Copy link
Author

The issue is not fixed!

jessehouwing added a commit to jessehouwing/azure-pipelines-task-lib that referenced this issue Nov 29, 2021
@jessehouwing
Copy link
Contributor

Lets see if actually providing the fix speeds up the process.

jessehouwing added a commit to jessehouwing/azure-pipelines-task-lib that referenced this issue Nov 29, 2021
@ckrueger1979
Copy link
Author

thx!

@jessehouwing
Copy link
Contributor

Since the tasks actually don't care about the actual files you package with it, you can grab a copy of the files from my repo and put that in your own custom task if you need them, or use them to patch another task that depends on these changes.

@jessehouwing
Copy link
Contributor

@AndreyIvanov42 please reopen and merge.

DenisRumyantsev added a commit that referenced this issue Nov 29, 2023
* Adds RecallOn* file attributes

Fixes #763

* Update powershell/CompiledHelpers/VstsTaskSdk.cs

---------

Co-authored-by: Denis Rumyantsev <v-denisr@microsoft.com>
fullstackinfo pushed a commit to fullstackinfo/azure-pipelines-task-lib that referenced this issue Aug 17, 2024
* Adds RecallOn* file attributes

Fixes microsoft#763

* Update powershell/CompiledHelpers/VstsTaskSdk.cs

---------

Co-authored-by: Denis Rumyantsev <v-denisr@microsoft.com>
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.

3 participants