Map control hanging on concurrent requests

Discussion created by lisardggy on Apr 18, 2012
Hi there.

I'm trying to understand the way the WPF Map control accesses the server data, and see why I'm getting hangs and timeouts on access.
Here's the scenario: I have a Map control linked to an ArcGisDynamicMapLayer and several FeatureLayers, all set to Load On Demand from an ArcGis server. When I scroll, pan, or zoom, there's I can see the map rendering the new extent every time. That's fine.

I also have some codebehind code that handles right-clicks and right-click-drags on the map. If the user right-clicks, I run a QueryTask against the geometry to see what entities are in the given area. This is run against the same layers as are displayed on the map (I often have overlapping entities, and sometimes I want them all).

Now, I hit a race condition. If, when I call my QueryTask, the Map control hasn't finished rendering yet, it will usually hang for 10-20 seconds, then give me a timeout error/communication failure. The whole UI is frozen for the duration, but after it's over I can keep working. If I wait for the rendering to complete before right-clicking, it works fine.

Does this scenario make sense? Is there a way to ensure the QueryTask runs concurrently with the Map control's rendering? Is this a client-side or server-side issue?

Thanks for your help,
   Avner Shahar-Kashtan