Click here to Skip to main content
15,898,819 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionConsole Application Help Pin
Dan Suthar4-Dec-08 1:31
professionalDan Suthar4-Dec-08 1:31 
AnswerRe: Console Application Help Pin
Wendelius4-Dec-08 9:46
mentorWendelius4-Dec-08 9:46 
GeneralRe: Console Application Help Pin
Dan Suthar4-Dec-08 20:28
professionalDan Suthar4-Dec-08 20:28 
GeneralRe: Console Application Help Pin
Dave Kreskowiak5-Dec-08 3:28
mveDave Kreskowiak5-Dec-08 3:28 
AnswerRe: Console Application Help Pin
Dan Suthar5-Dec-08 5:53
professionalDan Suthar5-Dec-08 5:53 
GeneralRe: Console Application Help Pin
Wendelius5-Dec-08 7:55
mentorWendelius5-Dec-08 7:55 
QuestionException handling Pin
Umangj3-Dec-08 15:34
Umangj3-Dec-08 15:34 
GeneralRe: Exception handling Pin
Luc Pattyn3-Dec-08 16:08
sitebuilderLuc Pattyn3-Dec-08 16:08 
Hi,

this is the most likely explanation:


if you want write or delete access (anything other than read access) to a file
that just got created (by yourself or someone else, does not matter),
chances are you will find the file is being accessed by some other process,
and your access is not granted.

The other process very likely is some server code that is there to assist you
somehow. Candidates are:
- anti-virus software (Norton, McAfee, whatever)
- indexing software (Google Desktop, MS Office, whatever)
The common thing is these packages are looking all the time for new files, so
they can inspect them.

Microsoft is aware of the consequences; Windows Explorer will try rename and
delete attempts up to five times (with one-second interval), and only reports
failure if the action continues to fail for that time.

The solution:
1. either use a different file name
2. or remove all background reader candidates (bad idea)
3. or implement the retry loop as Explorer has it (use a Windows.Forms.Timer
for this)

BTW: if all you need is Read, make sure to allow others to read as well, i.e.
use File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)



If you are convinced something else is going on, add try-catch (you should have done that straight away, every time and as soon as you do some I/O), display the entire exception text and the file name, note down the line numbers, tell your IDE to show line numbers, and publish all the details here.

Smile | :)

Smile | :)
locate the offending line.

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


GeneralRe: Exception handling Pin
Umangj3-Dec-08 17:45
Umangj3-Dec-08 17:45 
QuestionPointers and arrays problem Pin
Boo102-Dec-08 19:28
Boo102-Dec-08 19:28 
AnswerRe: Pointers and arrays problem Pin
Simon P Stevens2-Dec-08 23:00
Simon P Stevens2-Dec-08 23:00 
GeneralRe: Pointers and arrays problem Pin
Paul Conrad3-Dec-08 4:48
professionalPaul Conrad3-Dec-08 4:48 
AnswerRe: Pointers and arrays problem Pin
Paul Conrad3-Dec-08 4:49
professionalPaul Conrad3-Dec-08 4:49 
NewsReceive Windows 7 Beta 1 at a Local MSDN Developer Conference Pin
concordmfg2-Dec-08 12:24
concordmfg2-Dec-08 12:24 
QuestionNotSupportedException Pin
Developer6112-Dec-08 10:16
Developer6112-Dec-08 10:16 
AnswerRe: NotSupportedException Pin
Dave Kreskowiak2-Dec-08 10:41
mveDave Kreskowiak2-Dec-08 10:41 
GeneralRe: NotSupportedException Pin
Member 53148902-Dec-08 18:40
Member 53148902-Dec-08 18:40 
GeneralRe: NotSupportedException Pin
Dave Kreskowiak3-Dec-08 1:46
mveDave Kreskowiak3-Dec-08 1:46 
QuestionDynamic picturebox allocation Pin
Umangj2-Dec-08 8:08
Umangj2-Dec-08 8:08 
QuestionPls Reply guyz Pin
Umangj3-Dec-08 2:43
Umangj3-Dec-08 2:43 
AnswerRe: Pls Reply guyz Pin
Paul Conrad3-Dec-08 4:52
professionalPaul Conrad3-Dec-08 4:52 
AnswerRe: Dynamic picturebox allocation Pin
Gideon Engelberth3-Dec-08 3:20
Gideon Engelberth3-Dec-08 3:20 
GeneralRe: Dynamic picturebox allocation Pin
Umangj3-Dec-08 15:35
Umangj3-Dec-08 15:35 
QuestionVB6 to VB.NET - DLL function arguments conversion Pin
boris.sclauzero2-Dec-08 6:00
boris.sclauzero2-Dec-08 6:00 
QuestionDoubt on Textbox Control !!!!! Pin
Suave_Shiva1-Dec-08 17:32
Suave_Shiva1-Dec-08 17:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.