laptop and a wrench

漏洞

In ArcGIS Maps SDK for .NET, synchronizing an edited feature with a related record from client A's device that was previously deleted & synced from client B's device will upload the feature from client A but the related record is missing.

ArcGIS Maps SDK for .NET
漏洞 ID 编号 BUG-000172341
已提交November 15, 2024
上次修改时间February 2, 2025
适用范围ArcGIS Maps SDK for .NET
找到的版本200.5
操作系统Windows OS
操作系统版本10.0 64 Bit
状态In Review

解决办法

To counteract the potential missing related record from Client B's sync,

  1. Perform a query on the related table to obtain the related records from the mobile geodatabase.
  2. Take the related record(s) to re-update the related table. Because deleting a feature from client A removes its related records, the app needs to re-update the related table before performing client B's sync.
  3. Next, relate the selected feature from the primary table to the related feature(s) from the query result (step 1) using the RelateFeature method to ensure that both records stay related as emphasized in the documentation link: https://developers.arcgis.com/net/edit-features/relate-features/#relate-two-features
  4. After Client B performs a sync, both the primary feature and its related record appeared in the attribute table. Additionally, the created_user field name remains unchanged from the initial edit session while the last_edited_user field name reflects the correct value from Client B.

Although the code snippet below is not a complete algorithm to copy-paste, part of the code can be used in a test app.

-----Code Snippet-----

ArcGISFeatureTable relatedTable = null;

GeodatabaseFeatureTable featureTable = null;

FeatureQueryResult result = null;

Geodatabase _resultGdb = await Geodatabase.OpenAsync(_gdbPath);

// Loading primary feature table and related table

foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables)

{

await table.LoadAsync();

if(table.LoadStatus == LoadStatus.Loaded)

{

if (table.GeometryType == GeometryType.Point)

{

featureTable = table;

}

else if (!table.HasGeometry)

{

ArcGISFeatureTable relatedTable relatedTable = table;

await relatedTable.LoadAsync();

}

}

}

QueryParameters queryParams = new QueryParameters

{

Geometry = selectionEnvelope,

MaxFeatures = 1

};

// Selecting feature to obtain attribute data

result = await layer.SelectFeaturesAsync(queryParams, Esri.ArcGISRuntime.Mapping.SelectionMode.New);

Feature feature = result.First();

feature.SetAttributeValue(AttributeLabelFieldInput.Text, AttributeLabelFieldValue.Text);

// Primary attribute field name shares the same attribute data/value with the related record

var relatedFieldValue = feature.GetAttributeValue("PrimaryAttributeFieldName");

// Perform a query on the related table using the field name and value in the where clause

var query = new QueryParameters()

{

WhereClause = $"RelatedFieldName = '{relatedFieldValue}'"

};

// Query result from the related table is used to re-update the related table

// Query result is also used to relate the feature from the primary feature table to the feature from the related table

// Primary feature table is then updated before performing a sync

FeatureQueryResult relatedFeatures = await relatedTable.QueryFeaturesAsync(query);

if (relatedFeatures != null)

{

ArcGISFeature arcGISFeature = (ArcGISFeature)feature;

foreach (ArcGISFeature relatedFeature in relatedFeatures)

{

await relatedTable.UpdateFeatureAsync(relatedFeature);

arcGISFeature.RelateFeature(relatedFeature);

}

await featureTable.UpdateFeatureAsync(arcGISFeature);

}

重现步骤

漏洞 ID: BUG-000172341

软件:

  • ArcGIS Maps SDK for .NET

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项