First off by changing one line of code in last example and tested it with looping 300 times and no problems.
I have to get going but and I have seen other people have problems that are similiar so will type up a better explanation and concepts to show what is happening.
I probably should rephrase the first sentence that I changed one line and no problems. It still a bad approach for the task and there are better ways but understanding why it is not a good approach helps to see what a better one would be.
If you want to start taking a look at what is going on look at methods
with ILSPY or Reflector you see what they do, and notice calls to methods that are explained in docs - acedSSGet, acedSSAdd, acedSSSetFirst, acedSSFree as they all play a role in it.
In the .NET API you actully never will use an instance of a SelectionSet object, one reason would be it is impossible since it is an abstract class.
You actually are using a SelectionSetDelayMarshalled object and there use to be a SelectionSetFullyMarshalled object but was removed in 2010 or 2011 or earlier.
Except for the SelectionSetDelayMarshalled constuctors that take ObjectIds as a argument, the other constructors pass the selection set to a internal class UnmanagedResources method AddSelectionSet which adds it to a key value pair collection, which passes it into constructor of a DisposableSelectionSet object.
I know that is a little jumbled but will make a better explanation later tonight or tommorrow .
Anyway the only change made was commented out first line and added second.
I greatly appreciate your time with your response. You have indeed fixed my issue with that little change. I am not sure I understand much in your message or why this one little change makes the difference but it does. Perhaps I can figure out why someday.
Have a great weekend,
I will do post will explanation but the Utils.SelectObjects calls acedSSAdd(null,null,...) which creates a new selection set in each loop without a matching acedSSFree().
Okay, That makes a bit of sense to me. Never would have thought about that when troubleshooting my code. I looked at that line numerous times while troubleshooting but just wasnt sure what else to use.
Thanks so much for your help! Greatly appreciated!
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.