cjmusial

Search not finding new object from same session

Discussion created by cjmusial on Mar 19, 2012
I've created an ArcMap 10 toolbar in C#.  The tool is operating on a geometric network and an edit session is open.  In some of the tools, it needs to create some new objects and also perform spatial queries that may return those new objects (among others).  The problem is that when the Search on the Feature Class is performed, it does not return those new features that were created in the same tool invocation (By tool invocation, I mean the code that's executed when the user clicks on a custom toolbar button in ArcMap).  When control returns from the tool, if I perform that same search (by clicking on the same or a different toolbar button), then the new features are found.  It only seems to have a problem when the new feature is created (and .Store 'd) and the search is performed in the same tool invocation.  I've tried putting the create and store of the feature in 1 edit operation and the search in a different one, but that doesn't seem to help.  It seems that there must be some cleanup or updating of indices done behind the scenes when the tool completes that I'm not aware of.  I've also tried emptying the spatial cache, but that doesn't work.  Can anyone point me to what I should be doing so that spatial searches can find the new features?

Thanks,

Chris Musial

Outcomes