I recently added functionality to our map application that would allow a user to reorder the layers on the map. Everything was working fine while testing the functionality in my local workspace. Once I released the functionality into our source control and other developers started using it, we noticed that the layers of a dynamic service stopped rendering correctly. It appeared to be the case that grouped layers would stop rendering after a certain amount of interaction with the map. The amount of interaction seemed to vary, but eventually the layers would always reach the same behavior of not rendering correctly. Occasionally, the layers would re-render correctly before disappearing again. I will try and provide as much detail as possible, in hopes that someone else has run into this issue and can guide me to a resolution.
I first noticed the issue in 3.25, and a change to 3.26 did not seem to resolve the issue. Functionally, I am creating a list of DynamicLayerInfos with the ArcGISDynamicMapServiceLayer.createDynamicLayerInfosFromLayerInfos method, reordering the list to match the new order, and passing the list into the ArcGISDynamicMapServiceLayer.setDynamicLayerInfos method. Tracing the call in a browser debugger, I am able to see the list being used by a web service request. The request header information shows the dynamic layer infos being passed through as an argument. Once we reach the point where the layers appear to stop rendering, I can see that the image that is returned only displays visible non-grouped layers from the service. It may be important to note that the layers are only being reordered within their own groupings. That is to say a layer will not be reordered among it's parent or children, only it's siblings. Another possibly related piece of information is that our application allows the user to adjust layer visibility. To accomplish this with dynamic services, we use the ArcGISDynamicMapServiceLayer.setVisibleLayers method. The service that we are testing with is a dynamic service that does support dynamic layers. The service has 61 layers, 15 of type Group Layer and 46 of type Feature Layer. Out of the 46, 42 are within a Group Layer and 4 are not.
Has anyone else run into this issue or have any insight?