Exception issue, vb.net 2005

S

Sid Price

I have an application with the following code:
Try

oFile = New FileStream(strConfigFile, FileMode.Create, FileAccess.Write,
FileShare.None)

'

' File is opened, write to it using XMLDocument

'

Dim oXMLFile As New Xml.XmlDocument()

'

' Set doc type

'

Dim xmlDeclaration As Xml.XmlDeclaration =
oXMLFile.CreateXmlDeclaration("1.0", "utf-8", "")

'

' Create the root element

'

Dim RootNode As Xml.XmlNode = oXMLFile.CreateElement("VMSchedule")

oXMLFile.InsertBefore(xmlDeclaration, oXMLFile.DocumentElement)

oXMLFile.AppendChild(RootNode)

'

' write out the data here ...

'

oXMLFile.Save(oFile)

oFile.Close()

Catch ex As Exception

System.Threading.Thread.Sleep(cFileAccessTimeout)

iRetry -= 1

End Try

The file is open with another application in order to test the exception
handling, however when I step through the code with the debugger an
"unhandled exception" message pops up when I execute the file open line. Can
anyone see why it thinks the exception is unhandled, I am trying to catch
it?

Thanks,

Sid.
 
A

Armin Zingler

Sid Price said:
I have an application with the following code:
Try

oFile = New FileStream(strConfigFile, FileMode.Create,
FileAccess.Write, FileShare.None)
....


End Try

The file is open with another application in order to test the
exception handling, however when I step through the code with the
debugger an "unhandled exception" message pops up when I execute the
file open line. Can anyone see why it thinks the exception is
unhandled, I am trying to catch it?

Menu Debug -> Exceptions: What is the setting for the CLR exceptions? Maybe
it is set to handle exceptions when they are raised.


Armin
 
S

Sid Price

Thank you for your suggestion,
Sid.

Armin Zingler said:
Menu Debug -> Exceptions: What is the setting for the CLR exceptions?
Maybe
it is set to handle exceptions when they are raised.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top