Problem with StopEditingTable

Good morning everyone.
I’m developing software for editing polygonal shape files and I’m having a strange problem and I can’t figure out the cause. I use Visual Studio 2019 Community with language Vb.Net.
Basically my program allows you to draw polylines on the map and save them on a shapefile.
The program works perfectly without any problems for a few days, then suddenly, any operation on the shapefiles (adding a point, creating a shape, etc.)
it runs more and more slowly until it becomes unsustainable.
At this point, if I try to delete the .shp, .shx and .dbf files to have the program recreate them, these files are created but the table attributes in the .dbf file are not created and therefore the
program no longer works.
Uninstalling and reinstalling MapWinGis didn’t help, so I found myself forced to format the pc.
It worked for a few days but then the problem came back.
I’ve had this problem on 3 different PCs.

Here is a piece of code that I use to create the attributes of a shapefile after creating it:

1 if sfgrafo.StartEditingTable() Then
2 sfgrafo.EditAddField(“id”, FieldType.STRING_FIELD, 2, 50)
3 sfgrafo.EditAddField(“name”, FieldType.STRING_FIELD, 2, 50)
4 sfgrafo.StopEditingTable() <— Slow operation
5 End If

The code runs fine until line 3 (the 2 fields “id” and “name” are added) but
the “StopEditingTable” instruction is very slow and after execution the 2 fields are gone.

Does anyone know how I can fix this?
Thank you for your attention.