Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another approach than File.Delete(tcFile)
Message
From
30/05/2012 18:33:35
 
 
To
30/05/2012 18:00:56
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01544721
Message ID:
01544871
Views:
23
>The documentation on the StandardError property (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standarderror.aspx) says that ReadToEnd will not complete until the process writes to its error stream or closes it. This can create a deadlock if it writes to its output stream first. See the paragraphs just prior to the examples section. It also details how to use the asynchronous methods like BeginErrorReadLine to avoid the deadlock.
>
>You will probably want to use the WaitForExit method (http://msdn.microsoft.com/en-us/library/ty0d8k56.aspx) to have the process finish before you continue instead of waiting the arbitrary 7 seconds. The WaitForExit call will need to be after reading the StandardError and StandardOutput streams or using their asynchronous equivalents.

Thanks, I read both of them.

I see they also mention to use Close() to free the allocating memory. I had assumed that this was not needed once we get out of the caller class as the scope of the object would have disappear.

I will add the following lines at the end:
            ' Wait for the process to complete before proceeding
            oProcess.WaitForExit()

            ' Frees all the resources that are associated with this component
            oProcess.Close()
The first one should be as you said. The second one is based on what I read in the 2nd document. Do you think that one is really necessary?

I haven't tested anything yet, as to know about removing the 7 seconds timeout and see if the problem we had earlier will not happen with this new setup.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform