Android Question B4A ver 5 error message

pevguitars

Member
Licensed User
Longtime User
With B4A Version 5 (in all my projects) I am getting the following error message dialog when I try to compile with F10

"An error occurred. Object reference not set to an instance of an object"

There is nothing in the log and no code highlight to tell me what is wrong.

Compiling with F11 or Alt3 works fine and the resulting programs are error free.

I would like to understand what is happening...

Thanks
Peter V
 

pevguitars

Member
Licensed User
Longtime User
Erel

Thank you for your very quick reply.

I have logged the B4A attempt to compile one of my projects using F10...

The result is attached..

Regards
Peter V
 

Attachments

  • log.txt
    4 KB · Views: 166
Upvote 0

SteveTerrell

Active Member
Licensed User
Longtime User
Erel

Thank you for your very quick reply.

I have logged the B4A attempt to compile one of my projects using F10...

The result is attached..

Regards
Peter V

I had that with the "If Not(up) Then" line in

B4X:
Sub CheckScreenOrientation(up As Boolean)
Dim ph As Phone
'
    If globalInvertOnReturn Then
        If Not(up) Then
            If lastO = 8 Then
            Else
                lastO = 8
                ph.SetScreenOrientation(lastO)
            End If
        Else
            If lastO = 0 Then
            Else
                lastO = 0
                ph.SetScreenOrientation(lastO)
            End If
        End If
    End If
End Sub
If

I changed it to

B4X:
If up = False Then

All ok, then back to Not(up) and then ok as well?

Initially I had to gradually eliminate all other code in the sub until only the If line was left and still had the error report (from the background compilation).
No such error previously with B4A V4.
 
Upvote 0

pevguitars

Member
Licensed User
Longtime User
Thank you Steve. Yes I use booleans directly as an If bool Then test.. a habit from my Delphi Coding. I will try what you suggest.

Later Edit : No it's not that in my case

Peter V
 
Upvote 0

SteveTerrell

Active Member
Licensed User
Longtime User
Thank you Steve. Yes I use booleans directly as an If bool Then test.. a habit from my Delphi Coding. I will try what you suggest.

Later Edit : No it's not that in my case

Peter V

It certainly ought to be something else! It is a most unhelpful error message.

I commented everything out of the sub almost line by line until the fault report disappeared then took the comment off the last line i changed and started commenting around it. That is how i ended up with just the If line (and its End If) with the fault still there. Then i experimented with what was in the If.

Quicker to do on a short sub! but it may be a way of getting you on the move again.
 
Upvote 0

SteveTerrell

Active Member
Licensed User
Longtime User
F10 is the shortcut for Step Out. It is not a shortcut for compiling your program. You need to use F5 or one of the other options to compile and run your app.

In my case the error message appeared and disappeared in the top of the logs window while i was editing.
 
Upvote 0

pevguitars

Member
Licensed User
Longtime User
Thank you Erel.

F5 works perfectly.

A word or two to thank you for your new version of B4A. Your new editor is really good. The upgraded auto-complete feature takes a little getting used to but, once in the rhythm of it, code writing is much faster. The highlighting of matching brackets and if-then and end-if is also a great time saver. I also like the line parsing feature that Steve mentioned above. Great work on your part...

Peter V
 
Upvote 0
Top