This project has moved and is read-only. For the latest updates, please go here.

Unable to cast object of type 'BruTileArcGIS.BruTileLayer' to type 'ESRI.ArcGIS.Carto.ILayer'

Mar 30, 2011 at 8:44 AM


Trying to loop over map layers in ArcObjects using the next code:

Dim layers As IEnumLayer = map.Layers

Dim lyr As ILayer = layers.Next()

Last line launches Unable to cast object of type 'BruTileArcGIS.BruTileLayer' to type 'ESRI.ArcGIS.Carto.ILayer' error if i have loaded a BruTile layer in the map (using version 0.3.3).

At least in trunk the code for BruTileLayer seem fine:


public class BruTileLayer : ILayer, ILayerPosition, IGeoDataset, IPersistVariant, ILayer2, IMapLevel,
        ILayerDrawingProperties, ILayerGeneralProperties, IDisplayAdmin2, ISymbolLevels, IDisplayAdmin, ILayerEffects
        , IDisplayFilterManager

Not sure if it's a problem of the code to loop through map layers (although seem ok for other layer types) or a bug in ArcBruTile.


Thanks in advance,

Jose García