File.Open just hangs and does nothing
I've never came across this issue. Can anybody tell me why does this code just hang and hang forever:
FileStream stream = File.Open("abc.xls", FileMode.Open, FileAccess.Read);
I am using Visual Studio 2010 Premium edition, Windows 7.
What can be the possible causes? Either it should throw exception or just run fine. Why does the program ju开发者_C百科st hang and never reach the next line of code after this?
Thanks in advance :)
A possible cause could be the size of the file, how big is it?
Can this same file be opened fine with other applications? Is it on a network or any other special kind of drive which may cause a delay? Are you sure that it is this one line which blocks (the debugger is sometimes a line off)?
Note: In contrast to the other answer given, I believe that the size should not have any impact on the performance when opening a stream. It doesn't actually read or do anything but opening the file.
精彩评论