var localCenterlineServiceMPK = new LocalFeatureService { Path = @"myPackage.mpk", MaxRecords = 100000 }; localCenterlineServiceMPK.Start(); var lineLayer = new ArcGISLocalFeatureLayer { Url = localCenterlineServiceMPK.UrlFeatureService + "/0", Service = localCenterlineServiceMPK, ID = "mylayerName", LayerName ="mylayerName", Editable = true, DisableClientCaching = true, AutoSave = false, Mode = FeatureLayer.QueryMode.Snapshot, OutFields = new OutFields { "*" }, Graphics = null, GraphicsSource = graphics }; lineLayer.Initialize();
System.InvalidOperationException occurred HResult=-2146233079 Message=Graphics collection must be empty before using GraphicsSource. Source=ESRI.ArcGIS.Client StackTrace: at ESRI.ArcGIS.Client.FeatureLayer.OnGraphicsSourceChanged(IEnumerable`1 oldValue, IEnumerable`1 newValue) InnerException:
Solved! Go to Solution.