Different types of ImageSource with PictureMarkerSymbol

12-06-2012 07:28 AM
Labels (1)
New Contributor
PictureMarkerSymbol takes an ImageSource as its Source property.

When I create a PictureMarkerSymbol using a valid BitmapSource, which is a descendent of ImageSource, I get a TargetInvocationExeption. The InnerException is as follows:

InnerException: System.NotSupportedException
       Message=Specified method is not supported.
            at ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ToJsonInternal(Action jsonReady, Boolean& dataPending, Boolean nativeMapSerialization)
            at ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ESRI.ArcGIS.Client.IJsonSerializableAsync.ToJson(Action jsonReady, Boolean& dataPending)
            at ESRI.ArcGIS.Client.JsonSerializableExtensions.SerializeToJson(Object o, Action jsonReady, Boolean& dataPending)
            at ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.GetSymbolJson(Graphic graphic, Action jsonReady, Boolean& dataPending)
            at ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphic(Graphic graphic, Geometry displayGeometry)
            at ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics()
            at ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.Initialize()
            at ESRI.ArcGIS.Client.NativeMap.AddLayer(Int32 index, Layer layer)
            at ESRI.ArcGIS.Client.DrawingSurface.AddLayer(Int32 index, Layer layer)
            at ESRI.ArcGIS.Client.AcceleratedDisplayLayers.TryAddLayerToDrawSurface(Layer layer, Int32 index)
            at ESRI.ArcGIS.Client.AcceleratedDisplayLayers.Draw(Envelope extent, Double resolution, MapPoint canvasOrigin, Boolean useTransitions, Boolean isContinuous)
            at ESRI.ArcGIS.Client.Map.loadLayerInView(Boolean useTransitions, Envelope drawExtent, Layer layer, Boolean isContinuous, Double scale)
            at ESRI.ArcGIS.Client.Map.loadLayersInView(Boolean useTransitions, Envelope drawExtent)
            at ESRI.ArcGIS.Client.Map.Layers_LayersInitialized(Object sender, EventArgs args)
            at ESRI.ArcGIS.Client.Map.<>c__DisplayClass10.<Layers_LayersInitialized>b__e()

Is PictureMarkerSymbol depending on ImageSource being a BitmapFrameDecoded?  I forgot to mention that this is in the WPF Runtime SDK 1.0.
0 Kudos
2 Replies
New Contributor
I've narrowed it down to the exception occurring if the ImageSource is a BitmapSource which is a CachedBitmap. 

It works fine if the ImageSource is a BitmapSource which is a BitmapImage.
0 Kudos
New Contributor
For now I'm using a work around where I encode the image source to a stream, and then load it as a BitmapImage, which PictureMarkerSymbol is happy to use as its Source.
0 Kudos