You may recall two weeks ago I had to use code like this to stop a COM
object from being collected:

 

GCHandle cursorHandle = GCHandle.Alloc(feature.Cursor, GCHandleType.Normal);

 

A few people suggested that it was overkill and simply making a local
variable reference to feature.Cursor would fix the problem.

 

It does!

 

Although I wonder if using a dummy reference is reliable. In Debug mode it
works, but in Release mode might it get optimised away and my problem will
return? I didn't try it.

 

Greg

Reply via email to