Why does this crash occur, and why only while debugging? It's preventing me from debugging a regular crash.

2564
3
11-25-2016 09:53 AM
JonathonGrivas
New Contributor III

In my ArcGIS Runtime v100.0 QML app, I'm experiencing a seemingly UI-caused crash which I am attempting to debug.  When I run in debug mode, the app crashes with exceptions before ever reaching that UI crash.  I am having difficulty debugging it due to my inexperience both with C++ and with the Qt/ArcGIS Runtime SDK architecture.  

The exception I receive is:

Exception at 0x7ffca7841f28, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in runtimecore!kdu_tile::get_mct_dwt_info

I am dynamically creating/deleting feature layers and tables with this function:

function changeLayer(layerId){
  if(featureLayer!==null){
    if(featureTable!==null){
      featureLayer.featureTable.destroy();
    }
    featureLayer.destroy();
  }
  var layerToRemove = null;
  map.operationalLayers.forEach(function(layer,layerIndex){
    if(layer === featureLayer){
      layerToRemove = layerIndex;
    }
  });
  if(layerToRemove !== null){
    map.operationalLayers.remove(layerToRemove);
    console.log("removed",layerToRemove);
  }
  featureLayer =  ArcGISRuntimeEnvironment.createObject("FeatureLayer",{},map);
  featureLayer.selectFeaturesStatusChanged.connect(selectFeaturesStatusChanged);
  var featureTableConfig = {
    url: featureServerUrl+layerId,
    featureRequestMode: Enums.FeatureRequestModeOnInteractionCache,
    credential: userCred
  };
  featureTable = ArcGISRuntimeEnvironment.createObject
      ("ServiceFeatureTable",featureTableConfig,featureLayer);
  featureLayer.featureTable = featureTable;
  featureLayer.featureTable.loadStatusChanged.connect(function(){
    if(featureLayer.featureTable.loadStatus==Enums.LoadStatusLoaded){
      actionBar.title = featureLayer.featureTable.tableName;
      var tempArr =[];
      for(var i=0,l=featureLayer.featureTable.fields.length;i<l;i++){
        if(featureLayer.featureTable.fields[i].editable){
          tempArr.push(featureLayer.featureTable.fields[i]);
        }
      }
      featureFields = tempArr;
    }
  });
  map.operationalLayers.append(featureLayer);
}

And this is the qml structure of the map on component load:

MapView {
  id:mapView
  anchors.fill: parent
  wrapAroundMode: Enums.WrapAroundModeDisabled
  attributionTextVisible : false
  Map {
    id: map
    // add the BasemapImagery basemap to the map
    ArcGISTiledLayer {
      url: baseMapUrl
    }
  }
  onMouseClicked: {
    mapView.identifyLayerWithMaxResults
      (featureLayer, mouse.x, mouse.y, 22, false, 1000);
  }
  
  onIdentifyLayerStatusChanged: {
    if (identifyLayerStatus === Enums.TaskStatusCompleted) {
      if (identifyLayerResult.geoElements.length >0){
        var geoElem = identifyLayerResult.geoElements[0];
        params.objectIds = [geoElem.attributes.attributeValue("objectid")];
        featureLayer.selectFeaturesWithQuery(params, Enums.SelectionModeNew);
      }
    }
  }
  QueryParameters {
    id: params
    maxFeatures: 1
  }
  
}

This is the part of the changeLayerId function where the crash seems to be occurring: 

featureTable = ArcGISRuntimeEnvironment.createObject
    ("ServiceFeatureTable",featureTableConfig,featureLayer);
0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

I'm not sure why it is crashing, but can you take that line of code and break it out into a simple reproducible test app?

0 Kudos
JonathonGrivas
New Contributor III

Unfortunately I have not been able to reproduce this with stripped down code and the public arcgis example services.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Maybe you can log a support ticket and give them your app that can reproduce the crash. They can help troubleshoot, and if it seems like a bug, then log a bug for us to debug it. Otherwise, it is difficult to say why it is crashing. The only other hope would be if you can get a stack trace

0 Kudos