Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: solenn on August 29, 2011, 10:41:15 pm

Title: EA crash with "EA_OnPreNewDiagramObject"
Post by: solenn on August 29, 2011, 10:41:15 pm
Hello,

I have a problem with event "EA_OnPreNewDiagramObject" in C#.
In fact, when I write the following code :

public bool EA_OnPreNewDiagramObject(Repository repository, EventProperties info)
{        
    return false;
}

In EA, I create an element in a diagram --> It's OK (the element is not created)
In EA, I drag and drop an element in a diagram (as simple link) --> It's OK (the element is not created)

In EA, I drag and drop an element in a diagram (as Instance of element) --> It's KO --> CRASH EA

Can someone help me?

Thanks a lot,
Solenn






Title: Re: EA crash with "EA_OnPreNewDiagramObject"
Post by: kisst2 on September 24, 2011, 06:51:22 pm
Hi,

what is the version of your EA?
In 9.1 release notes they state that the return value of EA_OnPreNewDiagramObject is temporarily ignored when creating an instance, but this should not result in a crash.
Maybe your add-in manipulates the repository on another method?
E.g.:
I have the need to allow on instances of a specific profile stereotype be created in a sequence diagram. EA_OnPreNewDiagramObject would be perfect for this, however it does not work, as described above.
So, I tried to delete the DiagramObject from EA_OnPostNewDiagramObject, in this case EA crashes for me. I will contact support, maybe they have a solution.

Cheers
Tibor