Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FileInfo.MoveTo delay
Message
De
29/11/2012 04:03:15
 
 
À
28/11/2012 09:06:22
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01558133
Message ID:
01558305
Vues:
55
>>My understanding is that when Windows moves a file to another folder on the same partition it simply modifies the path so the size of file should not be a factor.
>
>Ok
>
>>If you are using DirectoryInfo() then you could try calling it's Refresh() method before checking for the existence of the moved file.
>
>The DirectoryInfo() object is created after the MoveTo(). Are you suggesting that it might be possible that by the time I use that command that it cannot see the file yet because it has been called too fast after the MoveTo()?

No (although you may be right if MoveTo() is async), if DirectoryInfo() is instantiated after the MoveTo() then presumably the Refresh() would not help.

>>But it is still not clear to me what triggers the call to MoveTo() - as before, if this is an event (such as using Filewatcher) then you could have re-entrant code.
>
>I am not sure what the question is. This is simply VB.NET code.

But events are still events :-}
If the method containing the MoveTo() is triggered by an event then it's possible that a new call will tread on an existing one with obvious consequences. If that's a possibility then putting a lock on the method might be a solution.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform