<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IGPFunction2.Execute() never triggers when using IEnumLayer.Next() in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/igpfunction2-execute-never-triggers-when-using/m-p/752219#M19961</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I resolved this when attaching the debugger to the background process:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Turns out that right before Execute() is about to be called, UpdateMessages() is triggered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, the IGPUtilities.GetMapLayers() returns null and there fore an exception is thrown inside UpdateMessages().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGis then announces happily that the tool succeeded in 2 seconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Workaround: check the return value from GetMapLayers().&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Feb 2013 10:08:27 GMT</pubDate>
    <dc:creator>ØyvindIdland</dc:creator>
    <dc:date>2013-02-18T10:08:27Z</dc:date>
    <item>
      <title>IGPFunction2.Execute() never triggers when using IEnumLayer.Next()</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/igpfunction2-execute-never-triggers-when-using/m-p/752218#M19960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got an issue in a custom GP tool I don't really understand:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my UpdateMessages() method, I use the following code to run through all layers:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IEnumLayer enumLayer = gpUtils.GetMapLayers(); enumLayer.Reset(); ILayer layer = enumLayer.Next(); while (layer != null) { &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;code here&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; layer = enumLayer.Next(); }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The purpose is to look for layers with duplicate names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine when I don't run the tool in the background. In background mode however, the Execute() method is never&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;triggered. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to happen after enumLayer.Next(). When commenting away the enumLayer.Next() and the code below, it works again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are no error messages or exceptions occuring, and Arc claims that the tool executed succesfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When calling IGPMessages.AddMessage() as the first action in Exceute(), nothing is yielded.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something here ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oyvind&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 10:22:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/igpfunction2-execute-never-triggers-when-using/m-p/752218#M19960</guid>
      <dc:creator>ØyvindIdland</dc:creator>
      <dc:date>2013-02-16T10:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: IGPFunction2.Execute() never triggers when using IEnumLayer.Next()</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/igpfunction2-execute-never-triggers-when-using/m-p/752219#M19961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I resolved this when attaching the debugger to the background process:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Turns out that right before Execute() is about to be called, UpdateMessages() is triggered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, the IGPUtilities.GetMapLayers() returns null and there fore an exception is thrown inside UpdateMessages().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGis then announces happily that the tool succeeded in 2 seconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Workaround: check the return value from GetMapLayers().&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 10:08:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/igpfunction2-execute-never-triggers-when-using/m-p/752219#M19961</guid>
      <dc:creator>ØyvindIdland</dc:creator>
      <dc:date>2013-02-18T10:08:27Z</dc:date>
    </item>
  </channel>
</rss>

