c# - "The device is not ready" when writing or reading files -


when tried opening file, there exception "system.io.ioexception: 'the device not ready." showing up:

// reading var data = file.readalltext(@"d:\test.txt");  // writing file.writealltext(@"d:\test.txt", ""); 

my stack trace doesn't give meaningful message:

system.io.ioexception occurred
hresult=0x80070015
message=the device not ready.

source=mscorlib
stacktrace:
@ system.io.__error.winioerror(int32 errorcode, string maybefullpath)
@ 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)
@ system.io.filestream..ctor(string path, filemode mode, fileaccess access, fileshare share, int32 buffersize, fileoptions options, string msgpath, boolean bfromproxy, boolean uselongpath, boolean checkhost)
@ system.io.streamreader..ctor(string path, encoding encoding, boolean detectencodingfrombyteordermarks, int32 buffersize, boolean checkhost)
@ system.io.file.internalreadalltext(string path, encoding encoding, boolean checkhost)
@ system.io.file.readalltext(string path) @ [..].main(string[] args) in [..]\program.cs:line [..]


Comments

Popular posts from this blog

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -