Hi,
I am experiencing an unhandled exception when attempting to load an email from an XML file, but only when the file in question does not contain a complete XML email, for example an empty or corrupt file.
I have the following:
Try
Dim email as New Email
If email.LoadXml(sgFile) Then
'Email successfully loaded, do stuff
Else
'Write failure to log file...
End If
Catch ex As Exception
'Write error to log file...
End Try
My error handler does not trap the exception and the program terminates unexpectedly. In the system Event Log I see the following 2 events recorded:
Application Error
Faulting application name: MyProgram.exe, version: 1.1.10.0, time stamp: 0x59ad1431
Faulting module name: ChilkatDotNet46.dll, version: 9.5.0.65, time stamp: 0x58654057
Exception code: 0xc0000005
Fault offset: 0x00000000003adeaa
Faulting process id: 0x1f44
Faulting application start time: 0x01d3255b21bb005e
Faulting application path: C:Program Files (x86)MyMyProgram.exe
Faulting module path: C:Program Files (x86)MyChilkatDotNet46.dll
Report Id: 73e25f00-914e-11e7-80eb-00163e57b274
Faulting package full name:
Faulting package-relative application ID:
.Net Runtime
Application: MyProgram.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at <module>.ClsEmail.LoadXml(ClsEmail, XString)
at Chilkat.Email.LoadXml(System.String)
at MyProgram.MyProgram.MailChecker_ProcessFromXML(Boolean, Boolean ByRef)
at MyProgram.MyProgram.ImportTimer_Callback(System.Object, System.Timers.ElapsedEventArgs)
at System.Timers.Timer.MyTimerCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
Is there any way I can prevent this from happening?