AnsweredAssumed Answered

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

Question asked by jon.g@39dn.com on Nov 25, 2016
Latest reply on Dec 1, 2016 by LDanzinger-esristaff

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);

Outcomes