Book a Demo

Author Topic: Repository.OpenFile(path) in Windows Server 2012 R  (Read 8346 times)

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Repository.OpenFile(path) in Windows Server 2012 R
« on: August 06, 2015, 05:53:34 pm »
We're trying to run Repository.OpenFile(path) on a Windows Server 2012 R2, but it just stops. No errors are thrown, and it won't move on.

The same program works fine on my W8 laptop.

Help is much appreciated.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #1 on: August 06, 2015, 06:44:58 pm »
Are you running the code as a regular user, or as a service?
EA will only play nice with regular users.

Geert

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #2 on: August 06, 2015, 06:54:29 pm »
Regular user.

We're able to create a repository and execute EA, just not open a file.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #3 on: August 06, 2015, 07:44:00 pm »
Maybe a rights issue?

Geert

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #4 on: August 06, 2015, 07:47:35 pm »
The same user can open EA manually and open a file from EA's GUI.

So I don't think so :/

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #5 on: August 06, 2015, 09:09:44 pm »
Error in the file path maybe?

Often it's these type of silly mistakes that take the most time to debug.

I'm guessing there's some kind of system error/warning message that gets swallowed by the API.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #6 on: August 06, 2015, 09:24:18 pm »
Maybe you should post a code snippet.

q.

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #7 on: August 06, 2015, 09:32:24 pm »
We've tried to just enter a invalid filepath, but we get the same thing.

Code: [Select]
private void btnOpen_Click(object sender, EventArgs e)
        {
            try
            {
                String path = txtPath.Text;
                log("Path: " + path + " is ready to be opened.");
                if (path != "" || path != null)
                {
                    log("Path is not empty. Creating new repository.");
                    EA.Repository repository = new EA.Repository();
                    log("New repository created. Initializing repository.OpenFile(path)");
                    repository.OpenFile(path);
                    log("File is open. Closing file.");
                    repository.CloseFile();
                    log("File is closed. Ending EA.");
                    repository.Exit();
                    log("EA ended. Shutting down.");
                }
            }
            catch (Exception ex)
            {
                log(ex.Message + " StackTrace: " + ex.StackTrace);
            }
            
        }

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #8 on: August 06, 2015, 09:37:29 pm »
It never gets to the
Code: [Select]
log("File is open. Closing file."); part

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #9 on: August 06, 2015, 10:21:13 pm »
Quote
We've tried to just enter a invalid filepath, but we get the same thing.
So you still don't know whether your "valid" filepath is really valid. :-?

I still think you should be looking that way. Have you tried with a hardcoded string such as "C:\\temp\\test.eap" or something similar?

Geert

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #10 on: August 06, 2015, 10:29:46 pm »
We know the filepath is valid, but we tried to use an invalid one just to see if we got the basic "path invalid exception", that we get on a normal computer. But still nothing happens.

We have tried to use a hardcoded string, still nothing happens.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #11 on: August 06, 2015, 10:36:01 pm »
Then I'm all out of ideas.

If you don't find the reason you can send an email to Sparx support. They might have an idea.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #12 on: August 06, 2015, 11:16:43 pm »
As a side note: the test if (path != "" || path != null)does not make sense. I guess you meant && instead?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #13 on: August 06, 2015, 11:59:25 pm »
Quote
As a side note: the test if (path != "" || path != null)does not make sense. I guess you meant && instead?

q.
Even better would be to use
Code: [Select]
if (! String.IsNullOrEmpty(path))
Geert

KristianOdd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.OpenFile(path) in Windows Server 20
« Reply #14 on: August 07, 2015, 12:00:21 am »
Quote
Quote
As a side note: the test if (path != "" || path != null)does not make sense. I guess you meant && instead?

q.
Even better would be to use
Code: [Select]
if (! String.IsNullOrEmpty(path))
Geert

That is very correct, and I am awkwardly ashamed of that one.
However, it do not solve the problem, but thank you both.