IDynamicCacheLayerManager.Update crash when ConsolidatedGroupLayer set to False

Discussion created by ann-sofie on Feb 16, 2011

I'm developing an ArcEngine 9.3.1. application in VS2008 .NET (Visual Basic).

I'm using Dynamic Display in my application and would like to precook the cache.
I'm able to do that with IDynamicCacheLayerManager.Update when setting ConsolidatedGroupLayer = True, but when setting it to False my application crashes. I am not able to catch any error. I only get an application error refering to displaylib.dll. Has anyone been able to use Update when setting ConsolidatedGroupLayer to false?

When I precook the cache I loop through all layers and if it is a group layer I loop through all its child layers and do Update on all these. I have about 10-15 layers in 2 group layers for which I set ConsolidatedGroupLayer property to False.

Here is part of my precook code:

Dim pEnumLayer as IEnumLayer = pMap.Layers(Nothing, False)
Dim pLayer as ILayer = pEnumLayer.Next

Do While Not pLayer is Nothing
[INDENT]If Not TypeOf pLayer Is IDynamicLayer Then
[INDENT]pDynamicCacheLayerManager.Init(pMap, pLayer)
If TypeOf pLayer Is ICompositeLayer Then
[INDENT]If pDynamicCacheLayerManager.ConsolidatedGroupLayer = False Then
[INDENT]Dim pCompLayer as ICompositeLayer = pLayer
If pCompLayer.Count > 0 Then
[INDENT]Dim n As Integer = 0
For n = 0 To pCompLayer.Count - 1
[INDENT]Dim pChildLayer as ILayer = pCompLayer.Layer(n)
If Not TypeOf pChildLayer Is IDynamicLayer Then
[INDENT]pDynamicCacheLayerManager.Init(pMap, pChildLayer)
pDynamicCacheLayerManager.Update(pExtent, dFromScale, dToScale, esriMapCacheUpdateRecreateAll)[/INDENT]
pChildLayer = Nothing
End If
pCompLayer = Nothing[/INDENT]
[INDENT]pDynamicCacheLayerManager.Update(pExtent, dFromScale, dToScale, esriMapCacheUpdateRecreateAll)[/INDENT]
End If
[INDENT]pDynamicCacheLayerManager.Update(pExtent, dFromScale, dToScale, esriMapCacheUpdateRecreateAll)[/INDENT]
End If
pLayer = pEnumLayer.Next[/INDENT]


I would be greatful if someone could give me some help or ideas how to get this work.

/ Ann-Sofie