Select to view content in your preferred language

System.Exception: Invalid argument : Invalid graphic ID!

4379
4
05-21-2015 10:05 AM
RobertKennedy
Deactivated User

Hi All,

I'm curious is anyone has seen this exception before and had any ideas on resolution.

Background:

Basically we periodically create and remove graphics in a GraphicsOverlay, something akin to the following:

Add:

MapPoint pt = new MapPoint(lon, lat, elev, SpatialReferences.Wgs84);

pt = GeometryEngine.Project(pt, myMapRefSsytem) as MapPoint;

Graphic g = new PictureMarkerSymbol();

g.SetSourceAsync(new Uri(iconAnno.IconPath));

myGraphicsOverlay.Graphics.Add(g);

Remove:

myGraphicsOverlay.Graphics.Remove(f.Gfx);

0 Kudos
4 Replies
RobertKennedy
Deactivated User

Apparently submitted early.

Anyway, that typically works fine, but occasionally the arcgis API throws the exception listed below.

Anyone have any ideas?

System.Exception: Invalid argument : Invalid graphic ID!

   at RuntimeCoreNet.Interop.HandleException(Boolean retVal)

   at RuntimeCoreNet.CoreGraphicsLayer.RemoveGraphics(Int32[] ids)

   at RuntimeCoreNet.CoreGraphicsLayerWrapper.RemoveGraphicsInternal(RemovalInfo removals)

   at RuntimeCoreNet.CoreGraphicsLayerWrapper.UpdatePendingGraphics()

   at Esri.ArcGISRuntime.Controls.ViewBase.MapBatchProcess()

   at Esri.ArcGISRuntime.Controls.ViewBase._batchUpdateTimer_Tick(Object sender, Object e)

   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Windows.Threading.DispatcherOperation.Invoke()

   at System.Windows.Threading.Dispatcher.ProcessQueue()

   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Application.Run(Form mainForm)

   at MyApp.Program.Main() in e:\Fuse\Desktop\ESRIMap\source\MyApp\MyMain\Program.cs:line 198

   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()

0 Kudos
AsserSwelam1
Deactivated User

Hi Robert,

Can you attach a reproducible app to see the issue?

Thanks,

Asser

0 Kudos
RobertKennedy
Deactivated User

Hi Asser,

Sure thing, I was hoping to see if I'd get any quick responses before needing to pull it out of our product and into a stand alone app, but I can certainly look into that.  I'll keep you posted.

Cheers,

Bobby

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi Bobby,

We have fixed a couple of issues recently which might give rise to this exception - which is why we are keen to test your scenario on the latest internal build.

Are you sharing one layer instance between multiple active MapViews?

Cheers

Mike

0 Kudos