Author Topic: Orphaned EA.exe process - Interop.EA.dll [Solved]  (Read 678 times)

wmather

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Orphaned EA.exe process - Interop.EA.dll [Solved]
« on: January 04, 2018, 12:11:26 am »
Hi,

I am trying to automate the generation of my own documents by using a hybrid repository to walk all the required tables and assemble the required records.

This all works well, but as soon as I use EA.Repository() to save images, after my application finished, I have rouge EA.exe processes still running.

Is there something I am doing wrong so that the COM API closes the EA instance it has opened?

This is my code. Normally I let GC run in it's own time, but just forcing in-case it was the GC holding some COM lock. Please note this is EA 13.5.1352 Professional Edition

Code: [Select]
        private void ExportDiagrams()
        {
            var eaRepos = new EA.Repository
            {
                SuppressEADialogs = true,
                SuppressSecurityDialog = true
            };
            eaRepos.OpenFile(options.EAPFile);

            foreach (var d in Diagrams)
            {
                d.SaveImage(options.WorkingDir, eaRepos);
            }

            eaRepos.CloseFile();
            eaRepos = null;
            GC.Collect();
        }

        // inside my Diagram class...
        public void SaveImage(string dirName, EA.Repository repository)
        {
            var pi = repository.GetProjectInterface();
            repository.OpenDiagram(Diagram_ID);
            pi.SaveDiagramImageToFile($@"{dirName}\\{Diagram_ID}.jpg");
            pi = null;
            repository.CloseDiagram(Diagram_ID);
        }
« Last Edit: January 04, 2018, 12:59:37 am by wmather »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8482
  • Karma: +207/-26
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Orphaned EA.exe process - Interop.EA.dll
« Reply #1 on: January 04, 2018, 12:47:30 am »
I think you need to call Repository.Exit()

Geert

wmather

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Orphaned EA.exe process - Interop.EA.dll [Solved]
« Reply #2 on: January 04, 2018, 12:58:33 am »
damn! did not see that function even though it was in my face  :P

And yes, that does solve the problem as well