Hi, this is the problem:
When line parent.Elements.AddNew("<Element Name>", type); executes, throw a COMException with "Internal Error" message.
Any ideas??
[size=8] public EA.IDualElement AddChildElement(EA.IDualElement parent, EA.IDualElement child, string type, string stereotype, out bool success)
{
if (parent == null)
{
throw new ArgumentNullException("parent", "METESPA_Addin.Model.Dao:AddChildElement(EA.IDualElement parent, EA.IDualElement child, string type, string stereotype, out bool success)");
}
object element = null;
success = true;
try
{
if (child == null)
{
[highlight] element = parent.Elements.AddNew("<Element Name>", type);[/highlight]
}
else
{
element = parent.Elements.AddNew(child.Name, type);
}
success &= ((EA.IDualElement)element).Update();
parent.Elements.Refresh();
((EA.IDualElement)element).Stereotype = stereotype;
success &= ((EA.IDualElement)element).Update();
((EA.IDualElement)element).TreePos = parent.Elements.Count;
success &= ((EA.IDualElement)element).Update();
if (success)
{
OnAddedElement(((EA.IDualElement)element).ElementID, ((EA.IDualElement)element).PackageID, ((EA.IDualElement)element).ParentID, ((EA.IDualElement)element).Type, ((EA.IDualElement)element).Stereotype);
}
}
catch
{
throw new DaoException("METESPA_Addin.Model.Dao:AddChildElement(EA.IDualElement parent, EA.IDualElement child, string type, string stereotype, out bool success)");
}
return (EA.IDualElement)element;
}[/size]