.netvb.netwinformsagsxmpp

.NET Winform Program Terminating without any valid reason on End Sub


I'm using agsXMPP in my .NET project (WinForms) I have the following Code block, this is executed whenever a message is received from any client. Now whenever a message is received, this block executes and the program terminates.. :( I've no idea as to what's happening. Help!

Has this something to do with threads? (I've heard that agsXMPP encapsulates a thread on which it works)

   Private Sub messageReceived(ByVal sender As Object, ByVal msg As protocol.client.Message)
    Dim chatMessage() As String
    Static Dim Hi_ed As Integer = 0
    chatMessage = msg.From.ToString.Split("/")
    Dim chatSender As String = chatMessage(0)

    If Not IsWorking Then
        IsWorking = True
        If Not ProcessCommands(msg.Body, chatSender) Then
            Dim sStr As String = ParseEnglish(msg.Body)

            Select Case sStr
                Case "HI"
                    If Hi_ed = False Then
                        SendGTalkMsg("Hi. How do you do?", chatSender)
                        Hi_ed = True
                    Else
                        SendGTalkMsg("हाय वाई कुछ नहीं हम तो !!!", chatSender)
                    End If
                Case "DETAILS PLEASE"
                    SendGTalkMsg(". Currently there are N no of sams running on me: :)", chatSender)
            End Select
        End If
        IsWorking = False

        Exit Sub
    Else
        SendGTalkMsg("I'm working right now. Please have patience.", chatSender)
    End If
End Sub

** EDIT **** Now, when I run the EXE file generated, after this event is done the "not-responding" error comes, which clearly means that there is an exception but it's escaping the try catch block. :(

This is the error which I get:

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   updatecheck.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   4e8ed73e
Problem Signature 04:   mscorlib
Problem Signature 05:   4.0.0.0
Problem Signature 06:   4dd23522
Problem Signature 07:   1526
Problem Signature 08:   4f
Problem Signature 09:   System.InvalidOperationException
OS Version:  6.1.7600.2.0.0.256.1
Locale ID:  1033
Additional Information 1:   0a9e
Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
Additional Information 3:   0a9e
Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement       
offline:
C:\Windows\system32\en-US\erofflps.txt

Solution

  • Well, well, well. It was all because of a silly dialog box for the

    My.Computer.Network.DownloadFile(SourceZipFile, DestinationZipFile, "<userid>", "<password>", True, 100000, True)
    

    was set to true. So whenever the file download progress box appeared, it used to mess up with the threads. When I changed the ShowUI parameter of DownloadFile to False everything worked fine. :)

    But do we have a clear explanation to this?