B4J Question Javaobject Error in Debug Mode

Discussion in 'B4J Questions' started by swissmade, Jun 5, 2015.

  1. swissmade

    swissmade Active Member Licensed User

    Hi all,

    Maybe somebody has a solution for this.

    This code is giving me a error when I start this in Debug Mode.
    If I go Step by Step I don't get the error and the text is changed.
    In Release mode there is no error and the Code is changing my TitledPane Title Text.
    Code:
    Public Sub setTitledPaneText(TP As Node, Text As String )
    Try
      
    Dim jo As JavaObject = TP
      jo.RunMethod(
    "setText"Array As Object(Text))
    Catch
        ShowLog(
    "Error setTitledPaneText Functions"False)
    End Try
    End Sub
    It seems that something is going to fast in Debug Mode.
    Below the Sub where this is happening. Step by Step Debug and Release mode there is no problem and all is working well.
    Code:
    Private Sub SetRecreation()
    Try
        lstEmergencyTeam.Visible = 
    False
        lblEmergencyTeamCount.Visible = 
    False
        mnuVisitor.Visible = 
    False

        btnEditVisitors.Visible = 
    False
        EmergTitledAnchorPane.RemoveAllNodes
      
        
    Dim ap As AnchorPane
        ap.Initialize(
    "")
        ap.LoadLayout(
    "frmRecreationMenu")
        
    Dim img As Image
        img.Initialize(
    File.DirAssets, "Abo-Img.png")
        ABOImgRecreation.SetImage(img)
    '    ABOImgRecreation.PreserveRatio = False
        img.Initialize(File.DirAssets, "Barcode-1.png")
        DayImgRecreation.SetImage(img)
        DayImgRecreation.PreserveRatio = 
    False
        EmergTitledAnchorPane.AddNode(ap, -
    5, -5, -5, -5)
    '    DayImgRecreation.Left = (ABOImgRecreation.Left + (ABOImgRecreation.Width /2) - (DayImgRecreation.Width ))
        Functions.ShowLog(Functions.GetTitledPaneText(EmergTitledPane), False)
        Functions.setTitledPaneText(EmergTitledPane, 
    "Recreation")

    '    PrecenseTitledPane.Visible = False
    Catch
        Functions.ShowLog(
    "Error Set Recreation"False)
    End Try
    Maybe the attached file can help.
     

    Attached Files:

    • log.txt
      File size:
      30.2 KB
      Views:
      13
    Last edited: Jun 5, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload this project?

    Where exactly does it fail?
     
  3. swissmade

    swissmade Active Member Licensed User

    The project is too big to upload.
    SetRecreation I use in appstart after mainform.show.
    I also have try to do this with a delay. like a timer or CallSubDelayed.
    Its not helping.

    The funny thing is, that after a regclean it happens not all the time.
    If I use Step by Step debug or release mode I don't have this problem and all is working well.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    A different "code chain" is executed based on various parameters including breakpoints.

    I would be happy to try to run your project. If it is possible please send it to me by mail.
     
  5. swissmade

    swissmade Active Member Licensed User

    Difficult to do there are many Add Library's and Databases needed to run.
    I go to investigate something else.

    I use the program Fling to make real-time backups of changes in selected directory's to my Nas.
    Maybe this can be the cause. Files locked in the backup process.

    I will let you know if it's the problem.
    Anyhow in the meantime many thanks for your good support.
     
  6. swissmade

    swissmade Active Member Licensed User

    :(Bad not helping I still get this error sometimes.
    Maybe a Team-viewer session can be a option Erel??
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I don't think that a team viewer session will be very helpful. Does it happen when the app starts? Maybe you can try to reproduce it with a smaller project?
     
  8. swissmade

    swissmade Active Member Licensed User

    Hi Erel,

    Sorry for my late respond your mail was in the Spambox.
    I think I have found whats happening.
    If I edit at a breakpoint say insert the line Log("Your Log") and I press CTRL S the Program is missing the Row Order.
    Running code from Release and not from Debug.
    Sometimes the App Crashes.
    If I do nothing edit after this Crash I get the startup error again.
    If I edit and start the application there is no problem.
    I think that this has nothing to do with the Javaobject.

    This all only happens in debug mode Release mode is running very well.

    See Code and Screenshot.
    Code:
    Private Sub AXIOStartup()
    Try
    #If RELEASE
    '********** Init Thread
            TRRun.Initialise("TRRun")
    '**************************

        If TRRun.Running = False Then
            TRMap.Initialize()
    '        TRRun.Initialise("TR")
            TRRun.Name = "AxIOStartup Thread"

        '    TRRun.Start(Me, "StartAxIOStartup_1", Array As Object(TRMap))
            TRRun.Start(Me, "StartItUp_1", Array As Object(TRMap))
        '    TRRun.Sleep(100)
        Else
            Log("AxIOStartup Thread Still Running")
        End If
    #End If
    #If DEBUG
        StartAxIOStartup_1(Null)
    #End If
    Catch
        
    #If RELEASE
        Log("Error Starting AxIOStartup Thread " & LastException.Message)
        
    #End If
    End Try
    End Sub
    Private Sub TRRun_Ended(endedOK As Boolean, error As String'The thread has terminated. If endedOK is False error holds the reason for failure
       If endedOK = False Then
         
    Log(TRRun.Name & " Ended  " & endedOK & " " & error)
       
    Else
         
    Log(TRRun.Name & " Return OK")   
       
    End If   
    End Sub
    I hope this helps.
     

    Attached Files:

  9. Erel

    Erel Administrator Staff Member Licensed User

    Does it work properly if you don't use the hot code swapping feature?
     
  10. swissmade

    swissmade Active Member Licensed User

    Yes
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Last request, can you try to reproduce it in a small simple project?
     
  12. swissmade

    swissmade Active Member Licensed User

    I will try to do this.
    Problem I don't have small Projects.
     
Loading...