AsyncActionGroup-DisableAsync failed

AsyncActionGroup is not executed, if DisableMultiThread is True and DisableAsync was previously False.

BeforeScript (VBScript)
Action.DisableAsync = CBool(FBVariables.DisableMultiThread)

Action shows a green Completed, but the ChildActions were not executed.

I’m not able to reproduce this here. Also the CBool is unnecessary (on my machine it causes the script debugger to show, ie Visual Studio).

DisableAsync_VBScript.fbp8 (2.0 KB)

CBool : I had tried many things and thought it was safe to say :slight_smile:

It works in your test script. With JavaScript, even if the file has a different name, it also works with VBScript.
I’ll try if the error stays if I remove everything else from our script.

The complete script looked like this, inside a child target page

' BeforAction
Action.LimitThreads = True
Action.MaxThreads   = Min(FBVariables.NUMBER_OF_PROCESSORS * 2, 15)
Action.DisableAsync = FBVariables.DisableMultiThread

' After Action (Reset so that no change is saved in the .fbp8)
Action.MaxThreads   = 20
Action.DisableAsync = False

this is how it works at the moment
if FBVariables.DisableMultiThread then Action.MaxThreads = 1 'Action.DisableAsync = FBVariables.DisableMultiThread

Since this happened on another target page and the error went unnoticed at first because nothing was visible afterwards, there is now a test.
with DisableAsync the error almost always occurs (FB, but currently I’m using MaxThreads=1.

' AsyncActionGroup: BeforeAction
FBVariables.zTempA = False
Action.LimitThreads = True
Action.MaxThreads   = Min(FBVariables.NUMBER_OF_PROCESSORS * 2, 15)
Action.DisableAsync = FBVariables.DisableMultiThread

' AsyncActionGroup: AfterAction
if not FBVariables.zTempA then
  call Err.Raise(1, "FinalBuilder", "Action wurde nicht ausgeführt")
end if

' First ChildAction: BeforeAction
FBVariables.zTempA = True

ProdatBuild.fbp8 (5.6 KB)

The SubActions are not executed here in the FB if DisableMultiThread is enabled.

You can comment out Err.Raise in the AfterAction of the AsyncActionGroup on second target page.

[edit] The Try-Finally, around the RunTarget, can be omitted.

I can reproduce this here.

Unfortunatley this isn’t going to work how you think it would because the AfterAction event fires before the child actions are run. So the AfterAction script is actually pulling the rug from under the internals of the action (something we will need to look at).

This is just how it has always been… a design decision I regret but changing it would be a major breaking change. I will look at adding a new AfterChildActions event in FB9.

Hmmm, an alert in AfterAction is then displayed after all ChildActions.
And the status also shows Running for as long as the childs are running.

We made some changes to this action that it captures the properties of the action when execution starts, this way changes to properties of the action in the afteraction script event will not impact on execution.

This build has that change.