I narrowed down a strange problem with an Add-In I'm currently writing. Maybe, someone can help:
I created a use-case-specific UI for the users to checkout data for editing in the field. When the user hits my "Run" button I call the GP-Tool management.CreateReplica to actually create the checkout-FGDB. This works fine as long as the user did not edit – in the same ArcGIS Pro session – any non-versioned feature class or table from the same workspace as the layers to be checked out.
private static async Task RunCheckoutGpTool(
FeatureLayer checkoutAreasLayer,
IList<MapMember> layersAndStandAloneTables,
string replicaName,
Geodatabase targetFgdb,
CancelableProgressor cancelableProgressor)
{
var parameters = Geoprocessing.MakeValueArray(
layersAndStandAloneTables, // Layers and tables to be checked out
"CHECK_OUT", // Replication type
targetFgdb.GetPath().LocalPath, // out_geodatabase
replicaName, // Replica Name
"FULL", // access_type
null, // initial_data_sender
"USE_DEFAULTS", // expand_feature_classes_and_tables
"DO_NOT_REUSE", // reuse_schema
"GET_RELATED", // get_related_data
checkoutAreasLayer); // Replication area
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync(
"management.CreateReplica", parameters, null, cancelableProgressor);
if (gpResult.IsFailed)
{
throw new Exception("Error executing Geoprocessing tool \"CreateReplica\":↵\n "
+ string.Join("↵\n ", gpResult.ErrorMessages));
}
}
Note: checkoutAreasLayer is a polygon layer for which I assured that only a single feature is selected.
<msg code=\"782\" type=\"100\">ERROR 000782: Read only data or unversioned data cannot be checked out. Full versioning is required for all replica data.</msg>
<msg code=\"-2147467259\" type=\"100\">Failed to execute (CreateReplica).</msg>
This message makes no sense to me because all feature classes and tables to be checked out are versioned and writable. Moreover, the same GP tool called directly using Pro's UI works fine (as mentioned in previous section).
I tested the Add-In on two machine. The problem is reproducible on both: my development machine as well as in the test environment:
Development:
Test:
Hi Ralf,
Can you check the contents of the layersAndStandAloneTables list that is passed in for the failed case? Other than this we will need to troubleshoot this problem. Would you mind logging a case with Technical Support and providing the repro case?
Thanks
Cheryl
Hi Cheryl,
Thanks for your answer.
I double-checked the layer list a number of times. Actually, to make sure the list is not the problem, I replaced it with hard-coded paths to the feature classes. Unfortunately, the behavior stayed the same.
I feared that I would need to contact Technical Support. Creating a repro case would essentially mean writing a new minimal AddIn that shows the problem.
Ralf