Home > Blockchain >  Given C# Winfoms application suddenly stopped working and launching on given computer
Given C# Winfoms application suddenly stopped working and launching on given computer

Time:09-09

Context

I use a WinForms/C# .NET utility (I cannot share it here) that I wrote years ago. It always launched as expected on any of my computers. It doesn't have any specific dependency other than some old version of .NET Framework. The software has not been changed for years and I have not made any recent changes to the system.

The issue - Part 1

I was using this utility through Remote Desktop on a secondary computer. I am not sure what happened but explorer.exe crashed or such and I had to restart the computer.

Since then, this utility doesn't launch anymore on that computer. I mean that when I click/double-click on its icon, mouse cursor briefly shows "loading" state, then nothing. It still works perfectly on other computers.

It feel like this given computer has decided to block that given utility? (I'm not sure at all, is it something that computers can do nowadays?)

How could I diagnose and solve this?

Note: I hesitated between posting this on SuperUser as this looks like a system issue and posting it here, but it looks like an issue that is very specific to .NET Framework so I posted it here

Things already tried

  • I tried uninstalling and reinstalling the application.
  • The system is protected by Nod32 AntiVirus, but I have no indication that it is related to the issue. I try turning the antivirus off but that didn't change anything, the application still doesn't launch.
  • I tried restarting the computer of course.

The issue - Part 2

In Windows 10 Event Viewer > Windows Logs > Applications, I found the following entry (followed by 3 other related entries but this one seems the most relevant). It seems like this system as a recurring issue with Xml parsing? At the time of parsing the application configuration? (Even after re-installation of the application.) How is this? How can I solve it?

Application: [MyApplication].exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Xml.XmlException
   at System.Xml.XmlTextReaderImpl.Throw(System.Exception)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32 ByRef, Int32 ByRef, Int32 ByRef)
   at System.Xml.XmlTextReaderImpl.ParseText()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at 

System.Configuration.XmlUtil.StrictReadToNextElement(System.Configuration.ExceptionAction)
       at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(System.Configuration.XmlUtil, System.String, Boolean, System.String, System.Configuration.OverrideModeSetting, Boolean)
       at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(System.Configuration.XmlUtil, System.String, Boolean, System.String, System.Configuration.OverrideModeSetting, Boolean)
       at System.Configuration.BaseConfigurationReco

rd.ScanSections(System.Configuration.XmlUtil)
   at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()

Exception Info: System.Configuration.ConfigurationErrorsException
   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean)
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(System.Configuration.ConfigurationSchemaErrors)
   at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(System.Object, System.Configuration.Internal.InternalConfigEventArgs)

Exception Info: System.Configuration.ConfigurationErrorsException
   at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(System.Object, System.Configuration.Internal.InternalConfigEventArgs)
   at System.Configuration.Internal.InternalConfigRoot.OnConfigRemoved(System.Configuration.Internal.InternalConfigEventArgs)
   at System.Configuration.Internal.InternalConfigRoot.RemoveConfigImpl(System.String, System.Configuration.BaseConfigurationRecord)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
   at System.Configuration.BaseConfigurationRecord.GetSection(System.String)
   at System.Configuration.ConfigurationManager.GetSection(System.String)
   at System.Configuration.ClientSettingsStore.ReadSettings(System.String, Boolean)
   at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(System.Configuration.SettingsContext, System.Configuration.SettingsPropertyCollection)
   at System.Configuration.SettingsBase.GetPropertiesFromProvider(System.Configuration.SettingsProvider)
   at System.Configuration.SettingsBase.GetPropertyValueByName(System.String)
   at System.Configuration.SettingsBase.get_Item(System.String)
   at System.Configuration.ApplicationSettingsBase.GetPropertyValue(System.String)
   at System.Configuration.ApplicationSettingsBase.get_Item(System.String)
   at [MyApplication].UI.WinForms.Properties.Settings.get_UnrarExePath()
   at [MyApplication].Archive_tester_main_Form..ctor()
   at [MyApplication].Program.Main()

I have checked on a computer where the application launch without any problem, there is no such entry on that other computer.

Next idea I am suspecting that this XML is stored somewhere in the system, but I'm not sure where. It doesn't seem to be the .config file that is in application folder.

CodePudding user response:

The configuration file sometimes gets corrupted and gives an exception like this on settings load. Look at this question for example. Possibly your uninstaller is not removing the user settings and it's staying corrupted.

Look for user.config in AppData (in you app's directory) and see what it looks like.

  • Related