Bug? HttpJob never fires JobDone when using Debug Legacy, works fine in rapid

Thraka

Member
Licensed User
Longtime User
I don't know why but the HttpJob class isn't calling the JobDone method when I run on a physical device using Debug (Legacy) mode. If I change it to Debug (Rapid) it works correctly.

B4X:
'Class module
Sub Class_Globals
    Private tmrCheckInetConnection As Timer   
    Public IsConnected As Boolean = False
    Private OrighowOften As Int
    Private fastHowOften As Int = 8000
   
    Public OnConnectedEvent As clsEvent
    Public OnDisconnectedEvent As clsEvent
End Sub


'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(tmrHowOften2CheckMS As Int)

    OrighowOften = tmrHowOften2CheckMS '--- save original value
    tmrCheckInetConnection.Initialize("tmrCheckInetConnection",fastHowOften)
   
    OnConnectedEvent.Initialize
   
    tmrCheckInetConnection_Tick
   
End Sub


Private Sub JobDone (Job As HttpJob)
    Dim oldConnected As Boolean = IsConnected

       If Job.Success = True Then
          IsConnected = True
        ToastMessageShow("Checked internet - GOOD", True)
        'Log("INet connected)
        '--- we have a good connection so set to orig value
        tmrCheckInetConnection.Initialize("tmrCheckInetConnection",OrighowOften)
       
        'Previously it was not connected, so raise event that it is now connected
        If (oldConnected = False) Then
            OnConnectedEvent.Raise
        End If
       
       Else
       
           IsConnected = False
        ToastMessageShow("Checked internet - BAD", True)
        Dim s As String = "Inet... Error: " & Job.ErrorMessage
        g.LogWrite(s,g.ID_LOG_ERR)
          g.ToastMessageShowx("Unable to connect to the internet", True)
       
        '--- its not connected so set to every 8 sec
        tmrCheckInetConnection.Initialize("tmrCheckInetConnection",fastHowOften)
       
        'Previously it was connected so raise event that connection has been lost
        If (oldConnected) Then
            OnDisconnectedEvent.Raise
        End If
       
       End If
       Job.Release
    tmrCheckInetConnection.Enabled = True

   
End Sub


Private Sub tmrCheckInetConnection_Tick

    'tmrCheckInetConnection.Enabled = False
   
    Dim job1 As HttpJob
       job1.Initialize("job1", Me)
    job1.Download("http://www.google.com")
   
   
End Sub
 

Kevin

Well-Known Member
Licensed User
Longtime User
Note that the legacy debugger as it names suggests will eventually be removed.

Aren't there some things that are known to not be compatible with the rapid debugger? Aside from that, one of my projects simply refuses to run at all in rapid debug mode. I haven't stressed myself over that too much since it works fine in legacy debug mode but what you said concerns me.
 

Thraka

Member
Licensed User
Longtime User
It does not work in Release mode either.

If I create a new project from scratch, it works fine. I don't know why it doesn't work in my main project. Any ideas on how to investigate it?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Aren't there some things that are known to not be compatible with the rapid debugger? Aside from that, one of my projects simply refuses to run at all in rapid debug mode.
Not that I can think of right now. Can you send me this project?

Any ideas on how to investigate it?
Have you checked the logs for any messages?
 

Kevin

Well-Known Member
Licensed User
Longtime User
Not that I can think of right now. Can you send me this project?

Naturally I cannot get the rapid debugger to fail on any of my projects now while trying to remember which one it was. Perhaps it was a problem in my code that I have changed or perhaps it was something in the debugger that you have changed. I only used it a few times when it first came out (beta version, possibly) and honestly I haven't used it since after I had problems with it. I just went back to legacy debugging.

If I ever run into a similar problem again I will start a new thread and save an archive of the project for possible inspection. On the plus side, maybe I'll start using it again because it was nice when it worked for me.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…