Copy link to clipboard
Copied
I'm using c# to automate some Illustrator functionality. Using Visual Studio's watch window, the "Dynamic View" ability almost always gives the "Evaluation timeout" error. Not a big issue though because I have my own tool that uses .NET reflection to traverse a COM object and all its properties, which includes, of course, properties that are themselves COM objects. So, I ran it against Illustrator after opening a document.
So, I start Illustrator and open a document and start my tool. I get the Illustrator.Application properties displayed just fine. I then run my tool on the ActiveDocument property. So far, so good. I see the "Artboards" property and I run on it. This object is a collection and Illustrator has impelemented the standard enumerator, a.k.a., _NewEnum. The collection has a Count of 1, an Application property, an Item and Parent property. I'm cruising now.
I examine _NewEnum. When I have a standard, I do the following (stock stuff) to get all the objects and populate my UI:
if (objEnumerator != null)// beter not be null!
{
objEnumerator.Reset();
while (objEnumerator.MoveNext())
{
object o = objEnumerator.Current;
row[0] = "Object " + Count.ToString();
row[1] = o.ToString();
row[2] = "";
row[3] = "";
dataGridView1.Rows.Add(row);
++Count;
}
}
And, here it goes crazy. MoveNext never returns null object to indicate the enumerator has exhausted itself. Well, at least it never has and breaking into the code shows my "Count" variable well above 60,000, depending on how long I wait.
So, since I know in my case there is only one, I let it run up to five. I get back five com objects. The first one I can run the tool on to expand its properties and all is well. I get expected properties like the artboard name and I see they are fine. But, the rest - only property they return without an error is the Application object. And, I can expand it to get back to my starting point.
I picked another collection, Assets from the ActiveDocument and it does the same thing. I did select NonNativeObjects to expand it and it has a Count of 0. Expanding the object to get to _NewEnum and then expanding it I found that MoveNext immediately returns null.
I also expanded the Layers collectoin and saw, in my case, a Count of 3. When I expand its _NewEnum, it correctly enumerates three objects and then MoveNext returns null.
Copy link to clipboard
Copied
By the way, my tool shows the Application BuildNumber is 88R and Version is 28.0.0. Just in case you were wondering.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now