Unhandled Exception when running on another machine

    I am trying to install a program on another machine besides the developer. I keep getting the unhandled exception error whenever I try to start it. Runs fine on the development box. The other pc has .NET framework 1.1, MDAC 2.8. I've set the Security to Full Trust of the Intranet (it accesses a db) and localhost, as well as granting full trust to the assembly with the Wizard. I still cant' get it to work. Is there anything else to do on the new machine
     Also, is there any other way to catch errors vice the thread, and is it possible that the error is being thrown before my form even loads  How could I catch an error before the form loads
Thanks for the help.

Mark F
Houston, TX

I've added an exception handler to try and catch the error with the following code, but no go.

 Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler _
        Application.ThreadException, New ThreadExceptionEventHandler(AddressOf Me.HandleExp)

        myData.Fill(DsPlate)
        btnNext.Visible = False
        btnEndSpec.Visible = False
        btn1.Visible = False
        btn2.Visible = False

    End Sub

Public Sub HandleExp(ByVal Sender As Object, ByVal t As _
       ThreadExceptionEventArgs)
        ' Treat the exception
        MsgBox("Unhandled Exception:" + _
           vbCrLf + t.Exception.Message)
    End Sub


Answer this question

Unhandled Exception when running on another machine

  • MBiere

    Try to put the try-catch directly in your main method. It could be some memory problem or som null reference after the Initialize part that causes the error. I had that problem at least

    Something like:

    Public Class Form1 
      <STAThread()> Shared Sub Main()
        Try 
          Application.Run(new Form1())
        Catch ex As Exception
          MessageBox.Show(ex.Message & "\n" & ex.Source & "\n" ex.TargetSite & _  
          "\n" & ex.StackTrace, "Error")
        End Try
      End Sub
    End Class


    My VB.NET is a bit poor so there is surely some syntax errors in this exampel but I guess u get the idea :)

  • Aaron Whitney

    I added this code to check the form initialization and I got no return, just the unhandled exception error. I'm looking at putting error handling in other places. 
    If someone has some code for a "Universal" handler that gives me detailed messages I'd sure appreciate it.

    Thanks.

     Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.

            Try
                InitializeComponent()
            Catch
                Dim EX As exception
                MessageBox.Show(EX.ToString + " Component Initialization Failed", "Form Initialization Failure", MessageBoxButtons.OK, _
     MessageBoxIcon.Warning)

            End Try

  • GrahamWilliams

     I really don't know what type of exception. Where do you recommend that I put the try and catch  Right over the initialization of the form  Also, I'm fairly new to this, so would I use the a try/catch  Is there an unhandled exception handler in the catch
        I really appreciate the assist. This one has got me stumped.

    Again, thanks for the help.

    Mark F.
    Houston, TX

  • SmileMrk

    This is strange. Do you know the type of unhandled exception you are getting. Can you try having a try catch around the code where you instantiate the form

    Thanks,
    -Dinesh Chandnani

  • Unhandled Exception when running on another machine