When I try to call System.IO.File.Encrypt() on an existing file, it throws a generic IOException, and the message is “Parameter is incorrect”.
System.IO.File.Encrypt(“C:\Project\StorageDirectory\file.txt”)
The current user the process is running under has full control to the “StorageDirectory” folder. Is there something I’m missing permissions-wise?
The docs say this could be caused by
It could be that the file is locked by another process, or that you don’t have permission to modify it. You could run ProcMon while you reproduce this error to see if that’s your problem.