I have an asynchronous result coming back into a .NET / DA / Oxygene / Hydra client, which works fine, however I am having a problem with calling a FillDASQL call which is executed as a result of the invoked delegate. The method containing the Fill works fine when called from the plugin load and when just executed via a button for example. However it always hangs (no exception / no CPU activity etc.) when being executed as a result of a call when coming back from the async process. The aysnc result comes back like this :-
method TAN001RepClient.onServerBatchResult(aAsyncResult: IAsyncResult);
begin
var iResult: System.Int32 := cData.BatchTServiceA.EndTAN001_Extract(aAsyncResult);
Invoke(new InvokeDelegate(SyncEvent), array of System.Object([OXY003.InvokeType.onASyncResult, array of System.Object([iResult])]));
end;
The invoked method SyncEvent is :-
method TAN001RepClient.SyncEvent(aType: OXY003.InvokeType; params aArgs: array of System.Object);
begin
case aType of
OXY003.InvokeType.onMessage:
begin
end;
OXY003.InvokeType.onASyncResult:
begin
case System.Int32.Parse(aArgs[0].ToString) = -1 of
true : SetStatus(Status.Failure);
false : begin
LoadRepClientControl;
end;
end;
end;
end;
end;
…and the start of the LoadRepClient method looks like this :-
method TAN001RepClient.LoadRepClientControl;
var dsDataTable : System.Data.DataTable;
dsReader : System.Data.DataTableReader;
ParamArray : array of RemObjects.DataAbstract.Server.DataParameter;
dParam : RemObjects.DataAbstract.Server.DataParameter;
begin
dsDataTable := new System.Data.DataTable;
Array.Resize(var ParamArray,1);
dParam := new RemObjects.DataAbstract.Server.DataParameter;
dParam.Name := 'ControlKey';
dParam.Value := 0;
ParamArray[0] := dParam;
RemoteDataAdapterI.FillWithDASql(dsDataTable,qoxy0022,ParamArray);
dsReader := dsDataTable.CreateDataReader();
How can I avoid this hanging ? Is the fact that the FILL is being executed in the context of the main thread (I believe that’s right ?) the problem ?
There should be no issues on executing a DataAdapter’s method in a main thread context. Additionally this issue doesn’t reproduce on a simplified testcase, where .FillWithDASql operation is executed in a similar fashion. So it seems that the issue is caused by something else, more specific for your project.
I can suggest to run the project under debugger and (once it hungs) pause its execution and check where exactly the execution is paused. After that it should be much easier to pinpoind and resolve the issue.
Seems (not sure at this very moment, this requires deeper investigation) there is a race-condition somewhere in the event processing pipeline. Please contact us via support@ so we’ll provide you a fixed build once it is available.