Search code examples
vb.netappdatauser.config

App only runs in background until you delete AppData then it works correctly


I have a weird occurrence where the program sometimes only starts in the background and even if you kill it with task manager it still only starts in the background. When you navigate to AppData/Local/blahblah there is a user.config file. If you delete this the application can then start up normally. I am trying to figure out what can trigger this to happen. The only recurring point I can gather is it happens more often when the application did not close down correctly

The user.config file does not contain much info to help me find the problem

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <userSettings>
        <VetMaster.My.MySettings>
            <setting name="Skin" serializeAs="String">
                <value>Office 2007 Blue</value>
            </setting>
            <setting name="ConnectionStringUserOverride" serializeAs="String">
                <value>Data Source=LOUIS-PC\SQL2017;Initial Catalog=VetMaster;User ID=VetMasterXXX;Password=Vet1234XXX;Connect Timeout=60;Packet Size=16384</value>
            </setting>
            <setting name="SettingsID" serializeAs="String">
                <value>10</value>
            </setting>
        </VetMaster.My.MySettings>
    </userSettings>
</configuration>

Solution

  • As it turns out, the cause was (there is an auto-logout after 10min) And most people just close the app when that happens if they come back to the pc. Meaning all the other forms that were still open or for instance in the process of a sale just kind of chills in the background, which in turn screw up the next time the app tries to run. So some tweaks to how the auto-logout and open form closing works solved the issue.