Author Topic: application fails to load...  (Read 2257 times)

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
application fails to load...
« on: August 25, 2016, 03:05:24 PM »
Hi

Of the xx applications we have out there, occasionally we get an error that the application will not start.
The most recent one was 'root element' not found.
Move the complete application folder to a different directory/path & it works without any issue.
I used to think this was a windoze thing, but now not so sure..

Any ideas on what this could be?


from the error, it looks like the app is using the 'C:\Users\7 User\AppData\Local\' directory, even though where i have the app is in a different location.
I can provide the complete error if need be?



Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #1 on: August 25, 2016, 03:13:20 PM »
How are you deploying the application? Are you using the Application Settings that are built into Visual Studio such as for DB connection strings?

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #2 on: August 26, 2016, 05:26:29 AM »
Just by copying the entire VS application project, then creating a shortcut to the .exe under the BIN folder.
My assumption was that this was the preffered method to conform with the GPU thing..?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #3 on: August 26, 2016, 07:46:54 AM »
That is the preferred method of deployment. In that case, it should not be using anything in any other directory unless your program explicitly saves settings.

The next time you get an error, see if it lets you show more details that may point to a certain line of code, then post what you get.

DanieLoche

  • Guest
Re: application fails to load...
« Reply #4 on: August 29, 2016, 05:08:20 AM »
That is the preferred method of deployment. In that case, it should not be using anything in any other directory unless your program explicitly saves settings.

The next time you get an error, see if it lets you show more details that may point to a certain line of code, then post what you get.

The best way to get some "error messages" is to launch the application from the console.
With Linux it's quite simple. With windows... almost the same but the navigation through the documents to go to the folder of the application is annoying. ^^

If an error occurs, you will have the precise feedback in the console !

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #5 on: September 14, 2016, 02:52:31 AM »
That is the preferred method of deployment. In that case, it should not be using anything in any other directory unless your program explicitly saves settings.

The next time you get an error, see if it lets you show more details that may point to a certain line of code, then post what you get.
The program does save settings explicitly.
So if this is the cause, is there a fix?
I could look at modifying program so the settings that saved are read from PLC, but requires a bunch of rework most likely.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #6 on: September 15, 2016, 06:43:30 AM »
The program does save settings explicitly.
So if this is the cause, is there a fix?
Are you using the "Settings" feature that is part of VS or writing to something like an INI file via your own code?

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #7 on: September 24, 2016, 03:30:04 AM »
Using the 'settings' feature..
Going to assume by your question of a file (INI or similar) that maybe a file is better?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #8 on: September 24, 2016, 07:08:49 AM »
The "settings" tool is easy, but you have less control of where and how it stores the information. Typically the data will store in an XML file in the same directory as the executable. But as you move to different OS's I'm not sure where it all wants to access files.

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #9 on: September 25, 2016, 12:00:53 AM »
So suggestion is to change to an INI file or similar?
And the reason for the original post was due to the moving to different directory solved it.
So is likely that using the settings was/is he cause?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #10 on: September 25, 2016, 06:39:41 AM »
This is why I suspect the Settings as being the culprit

The error about 'root element' means it is trying to access an XML file that it either no longer there or corrupt. If you do not explicitly access the \AppData directory, the only other thing that I am aware of is the Settings. The Settings are also stored in an XML file which means it would be looking for a 'root element'

Now here is the one thing that doesn't quite make sense. If you are using XCOPY deployment, the XML setting files should be in the same directory as your exe. As opposed to using the Publish method which will store those files in the application data directory.

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #11 on: September 25, 2016, 10:26:12 AM »
Not explicitly using XCOPY, rather standard windoze copy with ctrl+c/ctrl+v etc.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: application fails to load...
« Reply #12 on: September 25, 2016, 10:46:31 AM »
XCOPY deployment is a phrase meaning to use a direct copy and not any setup, install, or publish program to install the software. It's a carry over from way back in the DOS days when you literally used the XCOPY command to copy everything including subdirectories.

lostcontrol

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: application fails to load...
« Reply #13 on: October 10, 2016, 01:35:37 PM »
Ok, thanks.
I sort of recognized it.

But back to my issue, I am also writing to the settings on a product change (not regularly).
Since all the products are stored in a file on the HMI, I use the settings to keep track of it by name.

By copying the complete application to another directory does not indicate file corruption though, maybe a permissions issue?

I have been contemplating a re-write of the application, as have been adding & adding to it & thing could be better. (as always).