I'm trying to save a custom layer by doing the following
ILayerFile layerFile = new LayerFileClass();
layerFile.New(saveFileDialog.FileName);
layerFile.ReplaceContents((ILayer)customProperty);
layerFile.save();
The custom property is actually CustomLayer2 which is nothing but a class that extends the BaseCustomLayer
It gets to layerFile.save() but then craps out. I get the following error
Error: HRESULT E_FAIL has been returned from a call to a COM component
I'm not sure if this is because I'm trying to save a custom layer or not. But since BaseCustomLayer extends the ILayer shouldn't this be all good? It's not failing at ReplaceContents and it looks like data is actually getting there. The only field that's null is ThumbNail. Can this be null? Does it need to be created in the CustomLayer class?
1 Answer 1
Try overriding all the IPersistVariant methods, if that doesn't work maybe implement IPersistStream.