Book a Demo

Author Topic: AccessViolationException after EA_OnNotifyConte...  (Read 6873 times)

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
AccessViolationException after EA_OnNotifyConte...
« on: August 05, 2008, 11:21:06 pm »
I've a problem with the EA Addin mechanism.

After changing an element at the EA-GUI, I use the method EA_OnNotifyContextItemModified() to start several rulechecks I have implemented.
In it I use Repository.GetProjectInterface().ValidateElement(GUID). In these rules I only read collections and don't modify them.

But immediately after the method EA_OnNotifyContextItemModified() has finished the program stops with an AccessViolationException in VisualStudio.

Has someone experienced the same problem or has maybe an idea?

Thanks for help
TheTwo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #1 on: August 06, 2008, 03:21:53 am »
Please tell us which products you are using, and the versions and build numbers of each. It's a bit difficult to decode the details as you've described it.

There were some notes recently about an access violation that might have been related, but it is difficult to tell without more information.
No, you can't have it!

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #2 on: August 06, 2008, 05:48:39 pm »
I'm using
MS Visual Studio 2005 v. 8.0.50727.762
Programing in C# .Net-Framework v. 2.0.50727
Enterprise Architect v. 7.0.818
Windows XP SP3

Thanks
TheTwo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #3 on: August 06, 2008, 09:56:09 pm »
OK. I'm therefore assuming you are not using any of the Sparx MDG products to connect with VS.

My guess is that the problem lies in your EA build.

As I mentioned, there were some posts that dealt with something similar. I have not searched them out - that's for you to do. These were definitely since build 818 (we are at 831 now). In fact, I think that you are still using EA 7.0 and the current release is 7.1. I cannot remember whether solutions predate the change to 7.1 but you can figure this out by searching the forum for the aforementioned threads. You should also take a look at the EA release notes; start at the release history page. There's a link on that page to release notes for builds before EA 7.1.

David
No, you can't have it!

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #4 on: August 07, 2008, 06:45:07 pm »
I'm only use Visual Studio to write the Add-In in C#. In EA I use the DLL I have created.

I've added a new ToolBox, a new element type and a new diagram type with my own MDG Technology file (XML) added by the Addin.

I've updated to Build 831 but without success.

Now I get the following error message in EA:

An error occurred while attampting to communicate with an Addin:
EA_Addin_Rulechecker(EA_Addin_Rulechecker.Main)
"EA_OnRunElementRule: External component has thrown an exception."
Please contact ...

And after this:

An error occurred while attampting to communicate with an Addin:
EA_Addin_Rulechecker(EA_Addin_Rulechecker.Main)
"EA_onPostNewConnector: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Please contact ...


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #5 on: August 07, 2008, 08:03:32 pm »
I cannot say what caused the first exception.

The second exception is almost certainly the result of your add-in program having been marked for cleanup after the first (unhandled) exception. References to objects within the scope of your add-in would then be considered invalid; the message you see is consistent with the expected result.
No, you can't have it!

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #6 on: August 11, 2008, 05:37:39 pm »
Has someone an idea what could cause this exception or how I can find the reason for it?

Thanks
TheTwo
« Last Edit: August 14, 2008, 09:15:31 pm by TheTwo »

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #7 on: August 14, 2008, 09:18:02 pm »
Hi,

Is it maybe possible that after creating an EAElement the Reository is not completely updated before the method EA_OnNotifyContextItemChanged()?

Thanks
TheTwo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #8 on: August 14, 2008, 09:49:22 pm »
Who knows...

Did you call Update() after creating the item? Has the code that handles your event got a clear picture of the containing collection (i.e. has the collection had a Refresh() called)?

David
No, you can't have it!

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #9 on: August 14, 2008, 10:53:49 pm »
The Element is not created through my Addin but simply with the Toolbox by drag and drop.

Then the the Method EA_OnNotifyContext.. is called by EA. and there I call an Repository.ValidateElement(GUID) on the EAElement.

Must be done some update between these two steps? Shouldn't EA do the update and refreshs by it self?

Thanks
TheTwo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: AccessViolationException after EA_OnNotifyCont
« Reply #10 on: August 15, 2008, 05:08:50 am »
I see what you mean.

Yes, IMO the whole thing should be handled by EA before the event.

Now, if I could only think of a solution. Perhaps the Sparxians or another user can shed some light on this.

David
No, you can't have it!