It is a bit tough to share the code, but let me see if I can get bits. I am assuming that it is because I am trying to delete another object from within the DeleteObject code. The thing is that I have objects which track other objects. If one is deleted, I want the object that is tracking to be deleted as well.
namespace someTools
{
public class someToolsPlugin : Rhino.PlugIns.PlugIn
{
public someToolsPlugin()
{
Rhino.RhinoDoc.DeleteRhinoObject += OnDeleteRhinoObject;
}
private void OnDeleteRhinoObject(object sender, RhinoObjectEventArgs e)
{
if(e.TheObject.ObjectType == ObjectType.InstanceReference)
{
someMethod();
Rhino.RhinoDoc.ActiveDoc.Objects.Delete(someRhinoObj, true);
}
}
}
}