Reputation: 6428
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 just hang and never reach the next line of code after this?
Thanks in advance :)
Upvotes: 1
Views: 659
Reputation: 60276
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.
Upvotes: 1