<?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: Weird Errors popping up on a stable ArcObject extension in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548304#M14827</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;has the data changed - The LRS/Route/Centerline No&lt;/LI&gt;&lt;LI&gt;version - No - -the version currently in production is about 2 years old and unchanged. &lt;/LI&gt;&lt;LI&gt;does it participate in a relationship class - No.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only real change to our production environment are the windows system updates...(Which I believe is the trigger for the exception...which one I don't know)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This program is real old and the do events and the GC.Collect, at time,&amp;nbsp; was necessary because of "out of memory errors" on client machines.&amp;nbsp; By "sprinkling them in" -those old errors went away.&amp;nbsp; I will try and remove the GC collection to see if the "Not in collection" exceptions go away... worth a shot.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would rather not start an edit session if I do not have to.... the performance within an edit session is horrible -- it is very very very significantly faster outside.&amp;nbsp; Some large datasets can two days to process inside an edit session whereas only hours outside.&amp;nbsp; So I am treating the edit session as a temporary work around for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will report back when I compile the changes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Mar 2015 17:20:20 GMT</pubDate>
    <dc:creator>TedKowal</dc:creator>
    <dc:date>2015-03-06T17:20:20Z</dc:date>
    <item>
      <title>Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548302#M14825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A custom extension, that has existed many years, stable,.. all of a sudden started get weird errors.&amp;nbsp; Basically this extension takes a point snaps it to a corresponding LRS and retrieves an Offset, Measure, Side, and a segment ID from the Centerline.&amp;nbsp; The last time this extension was re-compiled was around ArcGIS 10.0.&amp;nbsp;&amp;nbsp; I am currently running ArcGIS 10.2.2, the extension was performing fine .... the last successful run was month ago (Not something we run all the time).&amp;nbsp; No changes have been made to ArcGIS system.&amp;nbsp; The Window 7 system has only undergone bi weekly updates send out by microsoft. When I run the extension, I get two pop ups:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;"Item not found in this Collection"&lt;/LI&gt;&lt;LI&gt;after clearing the above pop-up... "Objects in this Class cannot be updated outside an edit session"&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The temporary work around is now run the extension after manually setting up an edit session ....&amp;nbsp; No edit session was ever required previously, last 7-8 years of use!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception is triggered on the pFeat.Store() execution.&amp;nbsp; "results" is a simple Collection .&amp;nbsp; The result collections contains all the correct information...pFeat is defined as an IFeature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I suspect it has something to do with the Window system....&lt;SPAN style="line-height: 1.5;"&gt;Has anyone else experienced this? Any fixes?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;'Return a cursor for all the features
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pCur = pFlayer.Search(Nothing, False)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat = pCur.NextFeature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until pFeat Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.Application.DoEvents()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Route = pFeat.Value(pFeat.Fields.FindField(fPointRouteName))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get point to pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mypoint = pFeat.Shape
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim results As New Collection
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC.Collect()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.Application.DoEvents()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; My.ArcMap.Application.StatusBar.StepProgressBar()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results = getms(Route, mypoint)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Update fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If results.Item("SegID") = -9999 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results.Remove("ErrDesc")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results.Add("No Centerline SegID Found", "ErrDesc")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Value(pFeat.Fields.FindField("MP")) = results.Item("MS")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Value(pFeat.Fields.FindField("Offset")) = results.Item("OFFSET")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Value(pFeat.Fields.FindField("rSide")) = results.Item("rSide")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Value(pFeat.Fields.FindField("ErrDesc")) = results.Item("ErrDesc")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Value(pFeat.Fields.FindField("SegID")) = results.Item("SegID")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat.Store()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch exp As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(exp.Message)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeat = pCur.NextFeature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:43:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548302#M14825</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2021-12-11T23:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548303#M14826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ted,&lt;/P&gt;&lt;P&gt;Its generally recommended that you do these sorts of updates within an edit session anyway, either manually or programmatically, just to trigger the events that other things may be listening to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has the data changed? versioned vs unversioned etc? does it participate in a relationship class? You'll need an edit session for those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd also take out GC.Collect. You need a really good cause for using it in code these days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 01:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548303#M14826</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-03-06T01:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548304#M14827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;has the data changed - The LRS/Route/Centerline No&lt;/LI&gt;&lt;LI&gt;version - No - -the version currently in production is about 2 years old and unchanged. &lt;/LI&gt;&lt;LI&gt;does it participate in a relationship class - No.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only real change to our production environment are the windows system updates...(Which I believe is the trigger for the exception...which one I don't know)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This program is real old and the do events and the GC.Collect, at time,&amp;nbsp; was necessary because of "out of memory errors" on client machines.&amp;nbsp; By "sprinkling them in" -those old errors went away.&amp;nbsp; I will try and remove the GC collection to see if the "Not in collection" exceptions go away... worth a shot.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would rather not start an edit session if I do not have to.... the performance within an edit session is horrible -- it is very very very significantly faster outside.&amp;nbsp; Some large datasets can two days to process inside an edit session whereas only hours outside.&amp;nbsp; So I am treating the edit session as a temporary work around for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will report back when I compile the changes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 17:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548304#M14827</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2015-03-06T17:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548305#M14828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just been looking at your code. Why don't you use an update cursor instead of the store()? I've always understood store() is simple to use but had poor performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At some point in the past I picked up on the &lt;STRONG&gt;Using&lt;/STRONG&gt; statement and &lt;STRONG&gt;ComReleaser&lt;/STRONG&gt; and I now code using these. They are supposed to ensure the correct release of cursors, below is some sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;' For ArcGIS 10 using VS 2010 you need to import the following
Imports ESRI.ArcGIS.ADF.Connection.Local
Imports ESRI.ArcGIS.ADF


Dim pQueryFilter As IQueryFilter
pQueryFilter= New QueryFilterClass
pQueryFilter.WhereClause = "ID = 1"
Using releaser As New ComReleaser
&amp;nbsp; Dim pFeatureCursor As IFeatureCursor
&amp;nbsp; pFeatureCursor = pFeatureclass.Update(pQueryFilter, True)
&amp;nbsp; releaser.ManageLifetime(pFeatureCursor)
&amp;nbsp; Dim pFeature As IFeature
&amp;nbsp; pFeature = pFeatureCursor.NextFeature
&amp;nbsp; While pFeature IsNot Nothing
&amp;nbsp; ' Do something with pFeature
&amp;nbsp; pFeatureCursor.UpdateFeature(pFeature)
&amp;nbsp; pFeature = pFeatureCursor.NextFeature
&amp;nbsp; End While
End Using&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:43:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548305#M14828</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T23:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548306#M14829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the time when it was written, Store() was the methodology and if my memory serves me correct, Nothing else worked with the memory problems except for sprinkling in the GC.Collect around until the memory issues went away (I did not understand nor currently understand fully the usage of GC.Collect).&amp;nbsp; Removing them (the memory problems come back?). I never revisited this program because I had no issues (If it is not broke don't fool around with it).&amp;nbsp; Assuming the memory issues are with the "releasing of the cursor", I like your code snippet!&amp;nbsp; However, I wonder if this would have anything to do with the "Item not found in the Collection" issue that has brought this to the front for discussion. I am being lazy and do not want to necessarily re-engineer the code again.&amp;nbsp; But in order to try out a few great ideas both you and Sean have have presented some refactoring of my logic in the code will have to occur....&amp;nbsp; This is turning out to be more of a challenge than a "Quick Fix."&amp;nbsp; -- I will keep you all abreast of my successes/(failures)&amp;nbsp; -- now I just need to carve out some time to work on this! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:06:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548306#M14829</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2015-03-17T14:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548307#M14830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Duncan,&lt;/P&gt;&lt;P&gt;Just to comment on the search vs update cursor. A search cursor is generally preferred in ArcMap as it takes advantage of any spatial cache, particularly when enterprise GDB's are used. An update cursor will always do a DBMS read to get the row. However, this probably only matters in the real world when you have a large number of clients hitting the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's some additional considerations in the help, &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/Updating_features/0001000002rs000000/"&gt;updating features&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 16:53:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548307#M14830</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-03-17T16:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Weird Errors popping up on a stable ArcObject extension</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548308#M14831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the link to that page, useful stuff!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duncan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 18:23:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/weird-errors-popping-up-on-a-stable-arcobject/m-p/548308#M14831</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2015-03-17T18:23:14Z</dc:date>
    </item>
  </channel>
</rss>

