Click here to Skip to main content
15,909,827 members
Home / Discussions / C#
   

C#

 
AnswerRe: Delegate awkwardness---is there a better way? Pin
PIEBALDconsult12-Oct-07 16:43
mvePIEBALDconsult12-Oct-07 16:43 
AnswerRe: Delegate awkwardness---is there a better way? Pin
S. Senthil Kumar12-Oct-07 22:45
S. Senthil Kumar12-Oct-07 22:45 
GeneralRe: Delegate awkwardness---is there a better way? Pin
Domenic Denicola13-Oct-07 7:28
Domenic Denicola13-Oct-07 7:28 
QuestionExtracting files from inside a file archive Pin
Luminare12-Oct-07 16:16
Luminare12-Oct-07 16:16 
AnswerRe: Extracting files from inside a file archive Pin
Roger CS13-Oct-07 11:52
Roger CS13-Oct-07 11:52 
GeneralRe: Extracting files from inside a file archive Pin
Luminare14-Oct-07 10:48
Luminare14-Oct-07 10:48 
QuestionSystem.IO.Exception Pin
solutionsville12-Oct-07 13:53
solutionsville12-Oct-07 13:53 
AnswerRe: System.IO.Exception Pin
Dave Kreskowiak12-Oct-07 15:35
mveDave Kreskowiak12-Oct-07 15:35 
Your code is reacting to the Created event immediately after the file is created, but probably before the file is closed by the process that created it, so yes, the file is being held open with DenyShareAll while it's being written by the other process. By the time you realize it and look at the file, it's done being written and has been closed.

That's one of the pitfalls of the FSW. Your code has to be written to retry file operations if your going to start modifying the file while it's still being written. If you can't open the file, you'll have to wait a second and retry the operation. Keep retying until you either reach some retry limit your've put in, or the file successfully opens.


A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: System.IO.Exception Pin
solutionsville12-Oct-07 16:02
solutionsville12-Oct-07 16:02 
GeneralRe: System.IO.Exception Pin
Dave Kreskowiak12-Oct-07 17:00
mveDave Kreskowiak12-Oct-07 17:00 
GeneralRe: System.IO.Exception Pin
solutionsville12-Oct-07 17:07
solutionsville12-Oct-07 17:07 
GeneralRe: System.IO.Exception Pin
Dave Kreskowiak13-Oct-07 3:01
mveDave Kreskowiak13-Oct-07 3:01 
AnswerRe: System.IO.Exception Pin
solutionsville13-Oct-07 9:44
solutionsville13-Oct-07 9:44 
QuestionProblem with launching an external process Pin
Togakangaroo12-Oct-07 10:44
Togakangaroo12-Oct-07 10:44 
AnswerRe: Problem with launching an external process Pin
Ennis Ray Lynch, Jr.12-Oct-07 11:28
Ennis Ray Lynch, Jr.12-Oct-07 11:28 
AnswerRe: Problem with launching an external process Pin
Daniel Grunwald12-Oct-07 23:53
Daniel Grunwald12-Oct-07 23:53 
AnswerRe: Problem with launching an external process Pin
Togakangaroo15-Oct-07 4:34
Togakangaroo15-Oct-07 4:34 
AnswerRe: Problem with launching an external process Pin
Togakangaroo15-Oct-07 7:09
Togakangaroo15-Oct-07 7:09 
QuestionButton Questions Pin
C# Beginner Nick12-Oct-07 10:08
C# Beginner Nick12-Oct-07 10:08 
AnswerRe: Button Questions Pin
Kristian Sixhøj12-Oct-07 10:13
Kristian Sixhøj12-Oct-07 10:13 
GeneralRe: Button Questions Pin
C# Beginner Nick12-Oct-07 10:16
C# Beginner Nick12-Oct-07 10:16 
GeneralRe: Button Questions Pin
Kristian Sixhøj12-Oct-07 10:17
Kristian Sixhøj12-Oct-07 10:17 
GeneralRe: Button Questions Pin
User 665812-Oct-07 10:52
User 665812-Oct-07 10:52 
GeneralRe: Button Questions Pin
Kristian Sixhøj12-Oct-07 10:57
Kristian Sixhøj12-Oct-07 10:57 
AnswerRe: Button Questions Pin
Kristian Sixhøj12-Oct-07 10:21
Kristian Sixhøj12-Oct-07 10:21 

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.