Select to view content in your preferred language

Bug: Unhandled exceptions on setting layer visibility while map control changing dimension

4804
2
10-21-2014 10:36 AM
EddieJesinsky
Deactivated User

I'm somewhat uncertain of the conditions to cause this, but it seems to occur when layers are added or layer visibility changed while the map control is in a transient state in the UI, in this case it is in a Telerik docking control that is being repositioned in the UI interface. Anyway, when the error occurs it bounce back and forth between ArgumentException/TargetInvocationException  in the OnLayerChanged event when calculating the full extent indefinitely. The application will proceed to crash at this point. I thought I would mention it because it seems like I will have to work around it for now, but the potential exception itself should be handled in ESRI.ArcGIS.Client.Map.getFullViewExtent() method

{System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Value does not fall within the expected range.

   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

   at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)

   at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)

   at System.Windows.UIElement.TransformToVisual(UIElement visual)

   at ESRI.ArcGIS.Client.Map.getFullViewExtent()

   at ESRI.ArcGIS.Client.Map.layer_OnLayerChanged(Object sender, EventArgs args)

   at ESRI.ArcGIS.Client.Layer.OnLayerChanged()

   at ESRI.ArcGIS.Client.GraphicsLayer.<CompositionTarget_Rendering>b__0()

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)}

  

{System.ArgumentException: Value does not fall within the expected range.

   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)}

0 Kudos
2 Replies
EddieJesinsky
Deactivated User

I was able to get around this issue for now by removing all of the map layers during the transient state and re-adding them to the layercollection upon receiving the Map.Loaded event

0 Kudos
LanceGoens
Occasional Contributor

I'm getting an identical stack trace on an error in my application. You mentioned your map was in a transient state and you believe that was part of the problem. Is there any event you've been able to attach to / break on to monitor the map status?

In my scenario, I'm getting this error after requesting a server side high-resolution print. The print completes successfully and I have a pdf of the map. However, my map has user added graphics that comprise of simple text symbols. If the user selects the graphics and wants to move them, the error is triggered.One thing to note is that I have added custom attributes to the graphic so that I can recognize them in code for other purposes. These attributes are stripped away prior to sending them to the server for printing as the print will not complete if they are there. Once the print completes, I re-add them back to the graphics. Any attempt to move them after this generates the worthless "Value out of expected range..."  error. I have no idea what is doing this. I've seen many google posts stating this is caused by attempting to add multiple objects to the visual tree where an item name already exists but I can't figure out what object that is. If this were related to my adding back of the graphic attribute, I would expect it to fail while attempting to add the attribute to the graphic but it does not.

Oh, and to further complicate this problem, this error only happens in IE. If browsing in Firefox or Chrome there is no error.

0 Kudos