V
Vinayak Raghuvamshi
I have a file that has been created using shared read/write access.
But C# code never is able to open this file for read and keeps
throwing "...cannot open file as it is being used by another
process...".
I verified that the file is indeed available for shared reading. here
is my code snippet. is there a bug in C# that i dont know, or is there
a bug in my code?
FileIOPermission perm = new FileIOPermission(PermissionState.None);
perm.SetPathList(System.Security.Permissions.FileIOPermissionAccess.Read,
logpath);
perm.Demand( ); // can we do shared reading? this call succeeds
System.IO.FileStream filestr = new
FileStream(logpath,System.IO.FileMode.Open,System.IO.FileAccess.Read);
// still throws
any hints?
-Vinayak
But C# code never is able to open this file for read and keeps
throwing "...cannot open file as it is being used by another
process...".
I verified that the file is indeed available for shared reading. here
is my code snippet. is there a bug in C# that i dont know, or is there
a bug in my code?
FileIOPermission perm = new FileIOPermission(PermissionState.None);
perm.SetPathList(System.Security.Permissions.FileIOPermissionAccess.Read,
logpath);
perm.Demand( ); // can we do shared reading? this call succeeds
System.IO.FileStream filestr = new
FileStream(logpath,System.IO.FileMode.Open,System.IO.FileAccess.Read);
// still throws
any hints?
-Vinayak