AnsweredAssumed Answered

IGPFunction2.Execute() never triggers when using IEnumLayer.Next()

Question asked by Oyvind.Idlandgeodata-no-esridist Employee on Feb 16, 2013
Latest reply on Feb 18, 2013 by Oyvind.Idlandgeodata-no-esridist
Hello,

I got an issue in a custom GP tool I don't really understand:

In my UpdateMessages() method, I use the following code to run through all layers:

IEnumLayer enumLayer = gpUtils.GetMapLayers(); enumLayer.Reset(); ILayer layer = enumLayer.Next(); while (layer != null) {     <code here>     layer = enumLayer.Next(); }


The purpose is to look for layers with duplicate names.

This works fine when I don't run the tool in the background. In background mode however, the Execute() method is never
triggered.

This seems to happen after enumLayer.Next(). When commenting away the enumLayer.Next() and the code below, it works again.

There are no error messages or exceptions occuring, and Arc claims that the tool executed succesfully.
When calling IGPMessages.AddMessage() as the first action in Exceute(), nothing is yielded.

Am I missing something here ?


Oyvind

Outcomes