I've had a bit of time to go through one of my apps and finally remove all the DoEvents and Msgbox calls.
I ended up removing all the code modules and replacing them with classes, and converting lots of subs into resumables, wait for, sleep etc.
In a couple of my classes, I am getting this error when MsgboxAsync is called.
I ran debug and the crash re-occurred.
Then I put a break point on the MsgboxAsync call, and the app didn't crash.
I then moved the breakpoint to the start of the function, and again, the app didn't crash.
I had a similar problem but different error message with MsgboxAsync2 in a different sub as well.
What could be going on here?
I have replaced a lot of code, and I have only had issues in these two places.
What could be going on?
I ended up removing all the code modules and replacing them with classes, and converting lots of subs into resumables, wait for, sleep etc.
In a couple of my classes, I am getting this error when MsgboxAsync is called.
error log:
Error occurred on line: 165 (RebuildC)
java.lang.NullPointerException: Attempt to read from field 'java.lang.ref.WeakReference anywheresoftware.b4a.BA$SharedProcessBA.activityBA' on a null object reference in method 'java.lang.Object anywheresoftware.b4a.keywords.Common.Msgbox2Async(java.lang.CharSequence, java.lang.CharSequence, java.lang.String, java.lang.String, java.lang.String, anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper, anywheresoftware.b4a.BA, boolean)'
at anywheresoftware.b4a.keywords.Common.Msgbox2Async(Common.java:486)
at anywheresoftware.b4a.keywords.Common.MsgboxAsync(Common.java:464)
at gtl.stockmate.rebuildc$ResumableSub_rebuildCount.resume(rebuildc.java:1130)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
I ran debug and the crash re-occurred.
Then I put a break point on the MsgboxAsync call, and the app didn't crash.
I then moved the breakpoint to the start of the function, and again, the app didn't crash.
I had a similar problem but different error message with MsgboxAsync2 in a different sub as well.
What could be going on here?
I have replaced a lot of code, and I have only had issues in these two places.
What could be going on?