in one of my program in C#, I got this error message:
System.ArgumentException occurred
HResult=-2147024809
Message=FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path.
Source=mscorlib
StackTrace:
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
InnerException:
I did research and find some clues from internet. listed them here for future reference.
the reason is that following message:
Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.
Saturday, December 19, 2015
file related problem in C# FileStream access
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment