0

A VB.net app I am running on a different machine to where I compiled it is exiting with windows errors.

It's a .net clr20r3 exception in system.net.sockets.socket, p7 is 2cb0 and p8 is 67.

According to Hans' answer here however the best thing to do is catch exceptions within the program to reduce the pain of tracking them down.

So I have surrounded my load method (it's a forms application so there is no main I can access - right?) with the following

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
        Form1_Load_internal(sender, e)
    Catch ex As Exception
        MsgBox(ex.ToString())
    End Try
End Sub

Still, however this does not catch the exception and I get the same .net exception.

Where might the exception be happening and how can I track it down?

nb I have some DllImports in the class definition too, could this be the problem?

<DllImport(dllname, EntryPoint:="get_license_details", SetLastError:=True, _
       CharSet:=CharSet.Ansi, ExactSpelling:=False, CallingConvention:=CallingConvention.StdCall)> _
Shared Sub get_license_details_dll(ByVal message As StringBuilder, ByRef gotlicense As Integer, ByRef candeauthorize As Integer, ByVal maxlength As Integer)
End Sub
Community
  • 1
  • 1
Sideshow Bob
  • 4,566
  • 5
  • 42
  • 79
  • Also the machine has no internet access at the moment. – Sideshow Bob Dec 04 '13 at 17:13
  • are you sure the exception happens in the Load event? You can create a Main method yourself if you need to catch any unhandled exception on the main thread (somewhere in the project properties) – Thomas Levesque Dec 04 '13 at 17:16
  • 2
    That's not what I recommended. I wrote "write an event handler for AppDomain.UnhandledException". Project + Properties, Application tab, View Application events. Use the Startup event instead of Main(). – Hans Passant Dec 04 '13 at 17:17
  • I have added the event handler for AppDomain.UnhandledException but I still get the same .net exception; it doesn't trap it. – Sideshow Bob Dec 05 '13 at 14:00
  • What do you mean by 'use the startup event instead of main()' - there is no main() that I can see so what do I do with the startup event? – Sideshow Bob Dec 05 '13 at 14:01

0 Answers0