P
puginews
I was wondering when you create a new xmltextreader (or any other
object for that matter), is it destroyed/closed (memory/resources
freed) when an exception occurs ?
Dim xmlrdr As New XmlTextReader(Me.Server.MapPath("staff.xml"))
Try
Do While xmlrdr.Read()
Loop
xmlrdr.Close()
lblWellFormed.Text = "Well-Formed"
Catch ex As XmlException
lblWellFormed.Text = ex.Message
End Try
I don't do anything with the data I read, is just to test if it is
well-formed XML.
When staff.xml isn't well-formed an XMLException occurs.
Are the resources then freed like in xmlrdr.Close() ?
How can I test this ?
Or should I add a Finally to the try-catch and put xmlrdr.Close() in
the finally ?
thanx,
Pugi!
object for that matter), is it destroyed/closed (memory/resources
freed) when an exception occurs ?
Dim xmlrdr As New XmlTextReader(Me.Server.MapPath("staff.xml"))
Try
Do While xmlrdr.Read()
Loop
xmlrdr.Close()
lblWellFormed.Text = "Well-Formed"
Catch ex As XmlException
lblWellFormed.Text = ex.Message
End Try
I don't do anything with the data I read, is just to test if it is
well-formed XML.
When staff.xml isn't well-formed an XMLException occurs.
Are the resources then freed like in xmlrdr.Close() ?
How can I test this ?
Or should I add a Finally to the try-catch and put xmlrdr.Close() in
the finally ?
thanx,
Pugi!