This program crash in Debug mode, but not in Release mode. Is it something to do with this?
Log in Release mode
Log in Debug mode
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
ResumableSub
Log("Continues after calling ResumableSub")
StartMessageLoop
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub ResumableSub()
Dim myEventGerator As Eventgenerator
myEventGerator.Initialize(Me,"Genarator ResumableSub")
Log("ResumableSub Waiting")
Wait For (myEventGerator) TheEvent(origin As String)
Log("The event happend in ResumableSub, raised by " & origin)
End Sub
B4X:
'Class module, class name is Eventgenerator
Sub Class_Globals
Private pTargetModule As Object
Private MyTimer As Timer
Private pID As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(TargetModule As Object, ID As String)
pTargetModule = TargetModule
MyTimer.Initialize("MyTimer",1000)
MyTimer.Enabled = True
pID = ID
End Sub
Public Sub MyTimer_Tick
CallSub2(pTargetModule,"TheEvent", pID)
MyTimer.Enabled = False
End Sub
Log in Release mode
B4X:
ResumableSub Waiting
Continues after calling ResumableSub
The event happend in ResumableSub, raised by Genarator ResumableSub
Log in Debug mode
B4X:
Waiting for debugger to connect...
Program started.
ResumableSub Waiting
Continues after calling ResumableSub
Feil oppstod på linje: 17 (Eventgenerator)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:460)
at b4j.example.eventgenerator._mytimer_tick(eventgenerator.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:628)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.objects.Timer$TickTack$1.run(Timer.java:118)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.ShellBA.startMessageLoop(ShellBA.java:119)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:153)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:308)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at b4j.example.main.main(main.java:29)
Caused by: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 2
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:131)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:78)
... 34 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:41)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:107)
... 35 more