Book a Demo

Author Topic: EA_OnPostNewPackage event triggers three times  (Read 5278 times)

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
EA_OnPostNewPackage event triggers three times
« on: January 07, 2020, 06:25:45 pm »
Hi,

 When I create a package, "EA_OnPostNewPackage" broadcast event is triggering three times, anyone helps me to resolve this?.

thanks

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #1 on: January 07, 2020, 09:44:30 pm »
Well, my glas bowl is broken. So a good guess would be: turn off any other add-in that might be in action.

q.

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #2 on: January 07, 2020, 10:18:47 pm »
Hi,

Thanks for your reply, but the same issue is continuing after disabling all other addin too.
Suggest me any other way to resolve this issue.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #3 on: January 07, 2020, 11:37:48 pm »
How about adding a bit more info? "Hey, it's not working" is definitely not enough.

q.

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #4 on: January 07, 2020, 11:48:52 pm »
Hi,

Thanks for your reply,

public bool EA_onPostNewPackage(EA.Repository Repository, EA.EventProperties info)
        {
            EA.Package package = Repository.GetPackageByID(info.Get(0).Value);
            System.Windows.Forms.MessageBox.Show("package Name:" + package.Name + " package ID:" + package.PackageID  + " Created On" + package.Created);
            return false;
        }
   
Here is My Broadcast event function, I simply added a package in EA, but MessageBox is triggering three times. What will be the issue? Can you suggest to me anyway to resolve this?
« Last Edit: January 07, 2020, 11:51:27 pm by conan »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPostNewPackage event triggers three times
« Reply #5 on: January 08, 2020, 01:19:48 am »
You can remember the packageID and make sure to only act on the first instance of the event.

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #6 on: January 08, 2020, 01:55:22 am »
Hi conan,


I see two possible issues here: either EA is calling your Add-In three times, or you have three copies of your Add-In installed.

I'm not sure how well EA's Add-In Manager deals with a situation where you've got different Add-Ins with the same name installed. That could possibly happen, especially if you're uncertain about how exactly the Add-In DLL is installed in Windows, and if it does (and if EA shows only one of them in the Add-In Manager) they would all respond to the event.

Try installing your Add-In on a clean machine, or try creating a completely new Add-In with NOTHING reused from the previous one, and see if that also gets triggered three times.

If EA does trigger your Add-In multiple times, that's a bug in EA that you need to handle along the lines that Geert suggested. You can report it as a bug, but don't expect it to be fixed any time soon.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #7 on: January 08, 2020, 09:40:16 am »
I did what Uffe was talking about: installed my add-in twice (for some reason). And yes, EA calls it twice. So for any registration one time. You should got the way Geert suggests: get a cleans install (VM, another machine), install your add-in as it should be done (once) and see what happens.

q.

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #8 on: January 08, 2020, 06:14:28 pm »
Hi,

Thank you so much for your reply, I used package ID and just called for first instance.


Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #9 on: January 08, 2020, 06:46:16 pm »
I did what Uffe was talking about: installed my add-in twice (for some reason). And yes, EA calls it twice.

Does it show up as two separate Add-Ins in the Add-In Manager? Or is EA confused?
My theories are always correct, just apply them to the right reality.

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #10 on: January 08, 2020, 07:14:49 pm »
Hi,

I didn't installed addin twice but EA calls it twice the EA_OnPostNewPackage event, why the issue is continuing. But I resolved by getting message box ones by logically.

thanks for your reply.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPostNewPackage event triggers three times
« Reply #11 on: January 08, 2020, 07:50:11 pm »
I can confirm this behavior.
I too see this event pop up three times for a single package creation.

You should report this as a bug to Sparx. My experience is a bit different from qwerty's. I did see a number my reported bugs solved in the last few years.

Geert

conan

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: EA_OnPostNewPackage event triggers three times
« Reply #12 on: January 08, 2020, 08:16:20 pm »
Hi,

Ok, I will Report as a bug to the Sparx community.

thank you.