Android Question Errors with Wait For in Debug Mode (v7.00 release)

GuyBooth

Active Member
Licensed User
Longtime User
I am seeing errors which I am having trouble tracing in the following code in a Class module. The error log only has 3 lines:

B4X:
Sub Process_AVTAction: MP_Clear_Next Requested
An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub mp_getupnpcommands_complete signature does not match expected signature.
public static void b4a.themusicmachine.clupnpplayer_subs_0._mp_getupnpcommands_complete(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
The code extract is
B4X:
        MP_GetUPnPCommands
        ' Wait for it to be done
        Wait For MP_GetUPnPCommands_Complete (ContainsStop As Boolean)
        If ContainsStop Then
            ' Now continue with the MP_Stop command
            MP_StopAsync
            Wait for MP_StopAsync_Complete (MP_Stopped As Boolean)
        End If
and the code that returns results to the two Wait For lines is:
B4X:
' Responses to UPnPReq other types using parser. Parse the XML string passed in
Sub UPnPReqParser_EndElement(Uri As String, Name As String, Text As StringBuilder)
    Dim sNewValue As String = Text.ToString
    Try
        Select Case Name
            (Cases)
                ....
            Case "CurrentTransportState"
                (Some Code)
                CallSubDelayed2(Me, "MP_StopAsync_Complete", sNewValue = "STOPPED")               
            Case "Actions"
                (Some Code)
                CallSubDelayed2(Me, "MP_GetUPnPCommands_Complete", sNewValue.Contains("Stop"))
            (More Cases)
        End Select
    Catch
        sErrorMsg = "TBCI App Error: " & CRLF & LastException
        TMM.LogError ($"${sCodeName}:${sErrorMsg}"$)
    End Try
End Sub
If I add the following sub:
B4X:
Sub MP_GetUPnPCommands_Complete (bResult As Boolean)
     
End Sub
the problem is pushed down to the second "Wait For" line, and the error log now has these lines:
B4X:
An error occurred:
(Line: 496) End Sub
java.lang.Exception: Sub mp_stopasync_complete signature does not match expected signature.
public static void b4a.themusicmachine.clupnpplayer_subs_1._mp_stopasync_complete(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
The (Line: 496) End Sub refers to a sub in a completely separate code module, and I can't see any relevance to the code being executed. If I then add this sub, the problem disappears:
B4X:
Sub MP_StopAsync_Complete (bResult As Boolean)
   
   
End Sub

This only happens in Debug mode. In release mode it is fine (even with the #BridgeLogger set).
Is this a bug?
 

GuyBooth

Active Member
Licensed User
Longtime User
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
I have sent you an email re uploading the project.

I believe I tried this when I first wrote it a couple of years ago. The XML feed isn't clean, headers aren't always complete or where they should be, and I think that is why I used this approach, which has been working.
Just FYI - no improvement with v7.01
 
Upvote 0
Top