How to trap error

A

anoj

Hi All,

I am facing a very strange problem. It crashes anytime unexpetedly.
I have put application level as well as form level Error handlers
But nothing works .

The startup of my Application is below :

Public Sub Main(ByVal CmdArgs() As String)
Try
Dim TmpFrm As New frmMain
If CmdArgs.Length > 0 Then
If IsNumeric(CmdArgs(0)) Then
TmpFrm.AudioParam = CmdArgs(0)
End If
End If
AddHandler Application.ApplicationExit, AddressOf
OnApplicationExit
AddHandler Application.ThreadException, AddressOf
OnThreadException

Application.Run(TmpFrm)
Application.Exit()
Catch ex As Exception
Try
Global.WriteToAppLog(ex)
Catch x As Exception
End Try
Application.Exit()
End Try
End Sub


Regards,
Anoj Kumar


Trace Message:


Index was out of range. Must be non-negative and less than the size of
the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at
System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG&
msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AudioConsole.Global.Main(String[] CmdArgs) in
E:\anoj\mywork\AudioConsole\Global.vb:line 152
 
G

Guest

I am facing a very strange problem. It crashes anytime unexpetedly.
I have put application level as well as form level Error handlers
But nothing works .

You might also handle AppDomain.CurrentDomain.UnhandledException.
Can you create this problem in the debugger?
 

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