AnsweredAssumed Answered

ServiceFeatureTable not properly initialized

Question asked by on Nov 10, 2015
Latest reply on Nov 12, 2015 by recrawford

We're noticing strange initialization behavior of ServiceFeatureTable when layer is not added to map and Map is not added to MapView.

We cannot query ServiceFeatureTable and cannot add new features.


ArcGIS Runtime version:


//create layer and initialize

var layer = new FeatureLayer(uri);

await layer.InitializeAsync();

//try query table

var table = layer.FeatureTable as ServiceFeatureTable;

var result = await table.QueryAsync(filter);

//last line fails with exception that table is not initialized, even though table.isInitialized == true


//try create new feature

var feature= table.CreateNew();

//last line fails with null reference exception. In debug mode we see clearly that Schema and some other properties are missing even though table.isInitialized == true


Everything works if we add this layer to a Map and MapView in UI (at runtime adding the layer only to Map which is not visible in UI does not solve the problem) and wait for MapView.LayersLoadedAsync().


So the question is, how should we propely initialize ServiceFeatureTable without adding layer to the UI? What does FeatureLayer.InitializeAsync() do if we still have to wait for MapView.LayersLoadedAsync()?

Is it a bug or expected behavior?


I think the question is related to this one, but the answer that was marked as correct seems not to be correct in our case (when feature table is used without MapView)

Re: Proper Way to Edit Service Feature Table Without Map