Strange problem with Beta 2.50 B3

corwin42

Expert
Licensed User
Longtime User
In an app I used Statemanager and HTTPUtils2.

Now I try to replace some static code modules with libraries. I created a library from statemanager and removed it from my app and included the generated library instead. That was the only change I have made to my code. Now I get the following error on compile:

Parsing code. 0.36
Running custom action. 0.14
Compiling code. Error
Error compiling program.
Error description: Process object is expected. {Type=HttpJob,Rank=0} is an Activity object.
Declaring the variable in Sub Globals instead of Sub Process_Globals will solve this problem.
Occurred on line: 30
TaskIdToJob.Put(taskCounter, job)
Word: job

It seems that the compiler thinks that HttpJob is an Activity object now. The error is reported in HttpUtils2Service.SubmitJob

Any ideas? It would be very hard to provide the project.
 

agraham

Expert
Licensed User
Longtime User
I'm not commenting on the problem but on the error message.

Somewhere else a similar error was posted and that error and this error both seem to contain contradictory information. It complains that a Process object is required then suggests declaring it in Sub Globals (where it will be an Activity object) instead of Sub Process_Globals :confused:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Thank you. This bug is fixed for the next update.

About the error message. I agree that it is a bit confusing. However it is correct.

Consider this code:
B4X:
Sub Process_Globals
   Dim m As Map
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
   Dim b As Button
   m.Put("b", b)
End Sub
The error will show as putting the Button in the process globals Map will create a memory leak. If however you declare the map in Globals instead then it will be fine.
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
Thank you. This bug is fixed for the next update.

Thanks very much. It was a bit strange because this error occured only after changing a code module into a library. Is there a workaround for this or will you release a new beta today?
 
Upvote 0
Top