Author Topic: Problem with Automation Interface and C#  (Read 349 times)

cbb

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Problem with Automation Interface and C#
« on: June 14, 2024, 12:56:28 am »
Some years ago, I developed a C# application to process data from an Enterprise Architect Project. I used that quite a long time flawlessly in a customer project. I think it was EA 14 at that time.
Then other projects with other tool chains came and I skipped some EA versions. Until now. So I wanted to reactivate my good old tool chain and installed the current EA Version (Corporate Licence).

But with the EA version 16.1.1628 the interaction between my C# application and EA does no longer work. I have no idea why.

The call repository = SparxSystems.Services.GetRepository(selectedProcess.Id) always returns null and the console output is "Failed to obtain Repository interface" which is a message directly from the GetRepository() Function.
The process id used is correct and Interop.EA.dll and SparxSystems.Repository are added as reference in the Visual Studio Project.

Strangely, access to EA works without problems with python. But no chance with C#.

Has anyone an idea what could cause this problem?
« Last Edit: June 14, 2024, 12:57:59 am by cbb »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8018
  • Karma: +118/-20
    • View Profile
Re: Problem with Automation Interface and C#
« Reply #1 on: June 14, 2024, 12:10:48 pm »
At a guess, your application was configured to reference C:\Program Files (x86)\Sparx Systems\EA\Interop.EA.dll. You've now installed the 64 bit version, which means that the path is C:\Program Files\Sparx Systems\EA\Interop.EA.dll.

cbb

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Problem with Automation Interface and C#
« Reply #2 on: June 14, 2024, 09:16:45 pm »
No. When adding the references, they are selected from the filesystem. I found out that it only does not work when running the application from within Visual Studio. More or less solved.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12995
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem with Automation Interface and C#
« Reply #3 on: June 14, 2024, 09:45:23 pm »
No. When adding the references, they are selected from the filesystem. I found out that it only does not work when running the application from within Visual Studio. More or less solved.
Probably because you are running VS as admin, and EA is not running as admin?
That is normal behavior and has always been like that.

Geert