Error message when closing editor / deleted dependencies

I use the Gantt Chart component with database adapter (Delphi 11.2). If I close the Gantt Task Editor with the Cancel button or with the "x" at the top right, the error message "Could not put dataset in edit mode" appears.
Furthermore, dependencies in the database are sometimes deleted. I can't yet reproduce under what conditions this happens.

Could you please help us with the exact steps that you take to generate this error?
As I'm not immediately able to reproduce this on my machine.

I double-click on an item so that the task editor opens. Then I close the editor with "x" or Cancel button. The error message always comes up for me. When I click the OK button, there is no error message. I have now also seen that with this error message a dependency between two other items is lost.

And is this with our demo application?
On the VCL or FMX framework or both?

No, this is not your demo. It is a VCL application. I don't use a clientdataset, but rather firebird 5, FDConnection and FDTable.
FYI: My ID field is an autoincrement field with a generator

According to the exception it seems to be either located in the LocateTask function which you can handle with the OnTaskLocate event if you don't use the event we use the internal DataSet Locate procedure.
The other reason when this exception is triggered is with the DataSet edit.

Unfortunately we don't have Firebird installed on our systems.
To check if it had the same issue with another source, I've tried it with an ADO table, but I was also not able to reproduce the issue (GanttDBADO.zip (112.2 KB)).

I don't use the event OnTaskLocate. Your program works.

Do you have an idea which settings I could look at in the Firedac components?

Maybe the following error messages that I get while debugging will help you:

Im Projekt Project1.exe ist eine Exception der Klasse EVariantTypeCastError mit der Meldung 'Variante des Typs (UnicodeString) konnte nicht in Typ (Int64) konvertiert werden' aufgetreten.(in System.Variants)
Im Projekt Project1.exe ist eine Exception der Klasse EDatabaseError mit der Meldung 'Ungültiger Wert für Feld 'ID'' aufgetreten.(in Data.DB)
Im Projekt Project1.exe ist eine Exception der Klasse Exception mit der Meldung 'Could not put dataset in edit mode.' aufgetreten.(in VCL.TMSFNCGanttChartDatabaseAdapter)

Can you check by using the OnTaskLocate event, first log the ATask.DBKey
if this is indeed a correct value that is retrieved.
And then you should do a locate on the firedac table.

This should give us an idea of the source of the issue.

procedure TForm1.TMSFNCGanttChartDatabaseAdapter1TaskLocate(Sender: TObject;
  ATask: TTMSFNCGanttTask);
begin
  TTMSFNCUtils.Log(ATask.DBKey);
  DataSource1.DataSet.Locate('Id',ATask.DBKey, []);
end;

Here is the output from a small Gantt chart with one task and two subtasks:

I notice that the issue happens when there is a task with no DBKey.
Could you check what is different for that task?

Is the DatabaseAdapter property AutoIncrementDBKey in Item set to True?
Then the DBKey should be retrieved after the insert.

The property AutoIncrementDBKey is set to True.
I don't see anything special about a task. Here is the data from the database:

ID;DEPENDENCIES;DESCRIPTION;DURATION;PLANNEDEND;PLANNEDSTART;PROGRESS;STATENAME;TASKNAME;WBS

If I add the lines
TTMSFNCUtils.Log(ATask.DBKey);
DataSource1.DataSet.Locate('Id',ATask.DBKey, );
in your ADO test project in the OnTaskLocate event, then I also get error messages there in debug mode.

Im Projekt GanttADO.exe ist eine Exception der Klasse EOleException mit der Meldung 'Die Argumente sind vom falschen Typ, liegen außerhalb des Gültigkeitsbereiches oder sind miteinander unvereinbar' aufgetreten.

We can not reproduce the issue here. Would you be able to give us a small sample project with this setup with the structure for your database.

So we can pinpoint the problem.

Here is the project. I was also able to recreate it with msAccess. The database (your database) is loaded from the c:\tms\ folder.
Just double-click on Task 1 and then chancel the task editor to get the error-message. I also zipped a compiled exe.
Testprojekt.zip (2.8 MB)

Thank you for the project, we were able to pinpoint the cause of this issue and we will try to get a fix as soon as possible.

The error message no longer appears.
But if I close the task editor (regardless of which task) with the Cancel or OK button, then the first task is overwritten with the last task in the database.
Here are two pictures of the values ​​from the database before and after closing the task editor

Unfortunately I'm not able to reproduce this issue locally.
Do you have the same problem with the ADO sample or the demo?

Are you using any events of the TTMSFNCGanttChartDataBaseAdapter?

With your advice I was able to quickly carry out a few tests. It seems to be due to the OnTaskLocate event. Even if there is only one comment there, the above error occurs.

I can't recreate the same error in the ADO example. However, changes there do not seem to be adopted if the event exists.

Is this OnTaskLocate event still assigned with no code in the procedure?
This might also be causing the issue. If the event is assigned then the default functionality isn't excecuted.