I'm trying to use an edit operation to populate attributes of a newly added field in a feature class. But the edit operation fails with the following message: "Edit operation failed. The data is currently locked by another user and cannot be saved"
My workflow is as follows:
What's locking the data? It's certainly not another user. I'm the only user. The gdb workspace is a temp folder in my user appdata dir.
The data isn't on the map or open anywhere else.
Yes this is an issue after Add Field or anything that grabs a schema lock. This was fixed in 2.0.
Hmm.. As I said in my previous post Add Field with shapefile as an input table produces lock files near shp. These lock files will be removed only when I close ArcGIS Pro. Is it OK? I suppose tools that change schema must delete locks were set by them. I see this behavior in 2.0.
You'll see a bunch of *.lock files in a geodatabase during normal operation. These are either shared or exclusive locks depending on what you are doing. Schema locks are a type of exclusive lock which are set on a dataset when its modified (add field, field index etc). Exclusive locks are normally removed when the operation completes. Shared locks are removed when the dataset is no longer being referenced by anything. In a file geodatabase you can get more information about locks via ArcObjects. For enterprises geodatabases there is a dialog (administer geodatabase in ArcMap or database properties in Pro).
For this particular bug, add field wasn't removing the exclusive lock in a timely manner.
Yes, I know about exclusive/shared locks since I work with them using ArcObjects. In ArcGIS Pro 2.0 I see that Add Field doesn't delete locks were set by this tool for shapefiles. Do you confirm this issue?
I am also getting the same behavior at 2.0, attempting to modify features in a file geodatabase. Closing and reopening ArcGIS Pro 'fixes' the issue.
Max and Tim, what are your workflows here to add the field and do an edit?
Are you adding a field manually or through code?
What sorts of edits are you making after that? Any .callback code?
Thanks
Sean
Hi Sean,
My workflow was:
In 1.4 this stuff works fine, in 2.0 not. Edit operation was failed with the "Edit operation failed. The data is currently locked by another user and cannot be saved" message. I even didn't fall to the callback's body.
But I fixed this with moving step 3 (adding of feature layer to a map) to the end of instructions list above. I decided to make a clean test creating test add-in and reproduce this workflow, and got no errors... So it is kind of mystic.
But as I said in my previous post "Add Field with shapefile as an input table produces lock files near shp". I mean executing the tool from ArcGIS Pro, not programmatically. Unfortunately I didn't see any reaction of the ESRI staff to this behavior. For me it seems like a bug.
Hi Max,
I still cant reproduce this with shapefiles. I tried a few things, through the UI with GP tools and the editor to create a shapefile, add a field and make some edits. No locking persisted.
Programmatically, create a shape file, add a field and calc values with editor callback. The shapefile wasn't added to the map during this. No locking persisted.
Programmatically, created a shapefile, added a field, added the shapefile to a new map, calc values with edit operation (callback isn't recommended here as the layer is in the map). No locking persisted.
In all three cases there are three shared resource lock files (*.sr.lock) remaining, but this is normal. They are removed when Pro exits, assuming nothing else is referencing the shape file.
Hi, I`m also encountering lock problems in the ArcGIS Pro SDK while creating and editing FGDB Feature Classes. Creation works without errors but the population with EditOperation only work once.
I`m calling
await Project.Current.SaveEditsAsync();
after my whole process is done, which should finish all remaining edit locks, or not? My code is shown here:
Writing Features into FGDB very slow
I`m repeating this multiple times in my running ArcGIS Pro session. User is selecting a MeasureSet, if its not availabale in FGDB it will be fetached from Postgres DB, written into FGDB and loaded into the map.
This works only once. The second time, fc is created in DB but I never enter my EditOperation callback, instead I get "ArcGIS.Core.Data.GeodatabaseTableException".
I have to reopen ArcGIS Pro to get it again work only once!!!
So this also doesn`t get fixed when migrating to 2.x?