Book a Demo

Author Topic: Enterprise Architect Interop COM Exception  (Read 3277 times)

arunraj

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Enterprise Architect Interop COM Exception
« on: December 30, 2019, 07:38:56 pm »
I have a console application written in C# that uses the Interop.EA.dll (from EA v12.1 on Windows 10 64bit) to create an EAP model. My app attempts to create a large number of packages, elements and diagrams.

The EA.Package, EA.Element and EA.Diagram objects are successfully created. However when I try to create EA.Element objects of type 'InteractionFragment' and EA.Partition objects, the app randomly receives the following exception:

Code: [Select]
System.Runtime.InteropServices.COMException: 'The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)'
The EA process which runs in parallel terminates and hence I am unable to debug any of the COM objects (watch window shows '((EA.DiagramClass)eaDiagram).DiagramObjects' threw an exception of type 'System.Runtime.InteropServices.COMException').
I tried to debug my app for null pointers, memory leaks etc. and everything seems to be in order. As a matter of fact, my app runs without any errors using a different configuration but the generated model was small.

Suspecting a memory fragmentation issue, I tried to close and reopen EA instance within my app. It did not help. I also tried calling Marshal.ReleaseComObject() but continued receiving the exception randomly. The location at which I receive the COM exception is different for each run.

As EA does not log errors (something that EA should definitely do!) and I was running out of options, I attached the debugger to the running EA process spawned by the Interop.EA.dll and observed that I receive the following exception:

Code: [Select]
Exception thrown at 0x00D5AA3E in EA.exe: 0xC0000005: Access violation writing location 0x28070B24.
Callstack:
Code: [Select]
> EA.exe!00d5aa3e() Unknown
  [Frames below may be incorrect and/or missing, no symbols loaded for EA.exe] Unknown
  EA.exe!005d5e3e() Unknown
  EA.exe!017bfc35() Unknown
  EA.exe!008ca7b0() Unknown
  EA.exe!008cafa6() Unknown
  EA.exe!017b4581() Unknown
  EA.exe!017bfc35() Unknown
  combase.dll!76b22e4b() Unknown
  combase.dll!76a73ab0() Unknown
  combase.dll!76ac44ae() Unknown
  combase.dll!76ac7c1d() Unknown
  combase.dll!76acb252() Unknown
  combase.dll!76aeaf4b() Unknown
  combase.dll!76ace495() Unknown
  rpcrt4.dll!76cc23fc() Unknown
  rpcrt4.dll!76c84f7c() Unknown
  oleaut32.dll!75227ce0() Unknown
  combase.dll!76a89321() Unknown
  combase.dll!76a89123() Unknown
  combase.dll!76a88c87() Unknown
  combase.dll!76abd951() Unknown
  user32.dll!76dc61bb() Unknown
  EA.exe!017aec45() Unknown
  EA.exe!00f8b5f1() Unknown
  EA.exe!017b1c72() Unknown
  user32.dll!76dc61bb() Unknown
  user32.dll!76db74dc() Unknown
  EA.exe!017aeae1() Unknown
  EA.exe!00b169e7() Unknown
  EA.exe!017bc2ca() Unknown
  EA.exe!01829025() Unknown
  EA.exe!017fd94e() Unknown
  kernel32.dll!74ea0419() Unknown
  ntdll.dll!7701662d() Unknown
  ntdll.dll!770165fd() Unknown

As I did not have much to debug further, I clicked 'Continue' and then the second exception occurs:

Code: [Select]
Unhandled exception at 0x77040711 (ntdll.dll) in EA.exe: 0xC015000F: The activation context being deactivated is not the most recently activated one (parameters: 0x00000003, 0x03A8FDA4, 0x03BC4258).
Callstack:
Code: [Select]
> ntdll.dll!77040711() Unknown
  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] Unknown
  ntdll.dll!77040711() Unknown
  user32.dll!76dc61bb() Unknown
  user32.dll!76db74dc() Unknown
  user32.dll!76db661b() Unknown
  user32.dll!76db63f0() Unknown
  EA.exe!017bc652() Unknown
  EA.exe!017bc2ca() Unknown
  EA.exe!01829025() Unknown
  EA.exe!017fd94e() Unknown
  kernel32.dll!74ea0419() Unknown
  ntdll.dll!7701662d() Unknown
  ntdll.dll!770165fd() Unknown

I again clicked 'Continue' and after around 28 such exceptions, my app finishes without receiving the RPC exception! Can someone please explain this strange behavior?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Enterprise Architect Interop COM Exception
« Reply #1 on: January 04, 2020, 12:11:25 am »
If you post the code we might be able to help.
Now it's just guessing game.

Geert