version delete denied, version in used

09-10-2019 11:10 PM
Esri Contributor

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.


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.


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.

0 Kudos
2 Replies
Esri Regular Contributor

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,


0 Kudos
by Anonymous User
Not applicable

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. 

0 Kudos