Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The process cannot access the file
Message
De
30/09/2008 18:27:51
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
30/09/2008 17:49:37
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01351711
Message ID:
01351947
Vues:
16
>Hi Paul,
>
>>Also, I'd suggest putting the Close() in a Finally section of a Try/Catch.
>
>Why do I get a "Use of unassigned local variable "stream" in the finally section.
>
>
>FileStream stream;
>XmlSerializer xml;
>try
>{
>    stream = File.Create(saveName);
>    xml = new XmlSerializer(spotStarter.GetType());
>    xml.Serialize(stream, spotStarter);
>
>    Debug.WriteLine("Saved", "Queue Item: " + saveName);
>    llSuccess = true;
>}
>catch (Exception ex)
>{
>    Debug.WriteLine("Saving to Queue", "Error: " + ex.Message);
>    LogException(ex);
>}
>finally
>{
>    stream.Close();
>}
>
Adding a stream = null in the finally does not cause the error. Does setting it to null force a close()?
Thanks
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform