Ok im still new to this but how in the world do i enable JIT debugging on my windows form application and where do i do it.
i have the following code
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
But i place it in my form but it doesn't work anyone know what i should do or where i should place it

JIT Debugging
Bryan Avery
chalna
Hi,
I think things have changed with Beta2. Did some R&D and finally out how to do this in VB 2005 and Beta 2. Here are the steps:
To manage an unhandled exception
1. With a project selected in Solution Explorer, from the Project menu select Properties.
2. Select the Application tab.
3. Click the View Code button to open the Code Editor.
4. This opens the MyEvents.vb file.
5. With the MyEvents.vb file open in the Code Editor, from the General drop-down menu select MyApplication Events.
6. From the Declarations drop-down menu, select UnhandledException.
7. The application raises the UnhandledException event before the main application runs.
8. Add code or MessageBox there which will display ur user friendly message.
Regards,
Vikram
jkiley
From your explanation it appears that when someone runs your application and your application encounters an unhandled exception then, they will be prompted to turn on JIT Debugging. If this is the case, you need to handle the exceptions.
Wrap your methods correctly within try-catch blocks and handle the exceptions in a user friendly way where you show your own message.
You can hook up to the Application.ThreadException to provide a global exception handler so that all exceptions are managed by your app.
See this link for more details on the ThreadException:
http://pluralsight.com/blogs/craig/archive/2004/06/13/1455.aspx
Regards,
Vikram
Biche
figuerres
Tools | Options. In the tree, expand Debugging and click Just-In-Time. Check the entries for the types of code for which you wish to enable JIT Debugging.
Phillip Marino
Fulano
Crimson_Blah
The following link has a sample for VB2005.
http://msdn2.microsoft.com/library/b602fb89(en-us,vs.80).aspx
Regards,
Vikram
Madjoo
http://weblogs.asp.net/fmarguerie/archive/2004/08/27/221428.aspx
http://www.dotnet247.com/247reference/msgs/50/250375.aspx
- mike
clehnert
soch
Ok i tried the code listed below, but it doesn't work either. IS there a special place i have to add it i added it at the beginning of my form
Code below
' Creates a class to throw the error.
Public Class ErrorHandler
Inherits System.Windows.Forms.Form
' Inserts the code to create a form with a button.
' Programs the button to throw an exception when clicked.
Private Sub button1_Click(sender As object, e As System.EventArgs)
Throw New ArgumentException("The parameter was invalid")
End Sub
<STAThread()> _
Shared Sub Main()
' Creates an instance of the methods that will handle the exception.
Dim eh As CustomExceptionHandler = New CustomExceptionHandler()
' Adds the event handler to the event.
AddHandler Application.ThreadException, AddressOf eh.OnThreadException
' Runs the application.
Application.Run(new ErrorHandler())
End Sub
End Class
' Creates a class to handle the exception event.
Private Class CustomExceptionHandler
' Handles the exception event.
Public Sub OnThreadException(sender As object, t As ThreadExceptionEventArgs)
Dim result As DialogResult = System.Windows.Forms.DialogResult.Cancel
Try
result = Me.ShowThreadExceptionDialog(t.Exception)
Catch
Try
MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop)
Finally
Application.Exit()
End Try
End Try
' Exits the program when the user clicks Abort.
If (result = System.Windows.Forms.DialogResult.Abort) Then
Application.Exit()
End If
End Sub
' Creates the error message and displays it.
Private Function ShowThreadExceptionDialog(e As Exception) As DialogResult
Dim errorMsg As StringWriter = New StringWriter()
errorMsg.WriteLine("An error occurred please contact the adminstrator with the following information:")
errorMsg.WriteLine("")
errorMsg.WriteLine(e.Message)
errorMsg.WriteLine("")
errorMsg.WriteLine("Stack Trace:")
errorMsg.WriteLine(e.StackTrace)
Return MessageBox.Show(errorMsg.ToString(), "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop)
End Function
End Class
CodeTool
Elroy
jhance_MS