AnsweredAssumed Answered

Reading Layer results in COM Component Fail in 10.6

Question asked by emanuelr on Jul 27, 2018

I'm having an issue upgrading from 10.5 to 10.6 libraries. When I try to get the layer information from a layer file it aborts. All I've done was to replace 10.5 with the 10.6 DLLs and this is what I get when I try to access the Workspace:

"

Error HRESULT E_FAIL has been returned from a call to a COM component.
StackTrace: at ESRI.ArcGIS.Geodatabase.IDataset.get_Workspace()
...

"

 

I have a licensed ArcGIS Server installed on the same box and I am initializing the license successfully, however it is failing when I try to access a layer file (I've tried layers from 10.2, 10.5 and 10.6). Am I missing something in the new DLLs? All I'm trying to do is:

"

var layerFile = new LayerFileClass();

layerFile.Open(m_filename);

...

var oLayer = layerFile.Layer;

...

var oDataLayer = oLayer as IDataLayer;

var oDataset = oDataLayer as IDataset;
if (oDataset == null) return;

var oWorkspace = oDataset.Workspace;

"

 

Any help would be appreciated.

Outcomes