Hi, I have a button that changes some layers to a specific version. Once a workflow is completed, those layers are then reconcile and post.
If there are no conflict, we then move those layers back to default using the tool as shown below.
Change
IGPResult gpResult = null;
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () =>
{
var parameters = Geoprocessing.MakeValueArray(constructLayer, "TRANSACTIONAL", newVersion.GetName());
gpResult = await Geoprocessing.ExecuteToolAsync("ChangeVersion_management", parameters);
});
If there are no issues with the reconciling, we will then delete the version.
jobVersion.Delete()
HOWEVER, I kept receiving the following message when I the Delete() method is called
"Operation not allowed because the version is in use."
The version is only used by me. If I restart pro then manually delete the version, it works fine. Can someone please advise what the approach to deleting version.
Hi Victor,
Deleting versions can be a tricky process. You have to ensure that all outstanding Rows, Tables, Feature Classes, Feature Datasets, etc. have been disposed. Read a description about this here.
Note also that Map has a method called ChangeVersion(). You could try using this to switch the layers in the map rather than the geoprocessing tool.
I hope this helps,
--Rich
Hi Victor,
On top Rich reply,
Geoprocessing async does not require to wrap with QueuedTask since it is corased-grained async method which does not use arcpro main thread.
Refer to below paper, only the MCT annotated fine-grained methods are required use this QueuedTask.
Below is the list of paper for your reference.
http://proceedings.esri.com/library/userconf/devsummit-dc18/papers/dev-dc-20.pdf
http://proceedings.esri.com/library/userconf/devsummit-euro17/papers/devsummit-euro_40.pdf