Book a Demo

Author Topic: Exception when creating a repository from external program.  (Read 3588 times)

jepessen

  • EA User
  • **
  • Posts: 106
  • Karma: +1/-1
    • View Profile
I've created a C# console application that uses Interop.EA.dll in order to open a Enterprise Architect project. I'm using Visual Studio 2019 and Enterprise Architect 13.

I've added the .dll in the references:



This is the class where I'm trying to open the repository:

Code: [Select]
using System;
using System.Collections.Generic;
using System.Text;

namespace EARedmineRequirementsConnector
{
    class EAConnector
    {
        private EA.Repository repository;

        [Obsolete]
        public EAConnector(Options options)
        {
            try
            {
                repository = new EA.Repository();
                repository.OpenFile(options.EAFilePath);
            }
            catch (System.IO.IOException)
            {
                Console.WriteLine("Cannot open file: " + options.EAFilePath);
            }
            catch(ExecutionEngineException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

When I run the program, I've an exception when creating the repository.

I don't understand which exception is and why I've this.



How can I create correctly the repository in order to open an existing file from an external application?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Exception when creating a repository from external program.
« Reply #1 on: June 05, 2019, 12:11:07 am »
Not sure what causes it, but you might find some answers here: https://stackoverflow.com/questions/967044/system-executionengineexception-failure

Geert

jepessen

  • EA User
  • **
  • Posts: 106
  • Karma: +1/-1
    • View Profile
Re: Exception when creating a repository from external program.
« Reply #2 on: June 05, 2019, 06:45:36 am »
Ok I've found the error: I was using a .NET Core project instead that a .NET Framework project.