Search code examples
.netexception.net-2.0

.NET Application broken on one PC, unhandleable exception


I have a .NET 2.0 application with nothing fancy in it. It worked until yesterday on every PC I installed or copied it to, no matter if 2.0, 3.0, 3.5 or 3.5 SP1 was installed, no matter if it was Win2000, XP or even Win7 (in total 100+ machines).

Yesterday I did my normal installation procedure and wanted to start it one time to check if everything is working...and it wasn't. The program crashed hard leaving me with the uninformative "Do you wanna report this error?" dialog. The problem is an exception in the Main(String[] args) routine of my application.

The event viewer is showing the following entry:

  Event Type: ErrorEvent
  Source: .NET Runtime 2.0 Error Reporting
  Event Category: None
  Event ID: 5000
  Date: 05/05/2010
  Time: 16:09:09
  User: N/A
  Computer: myClientPC
  Description:
  EventType clr20r3, P1 apomenu.exe, P2 1.4.90.53, P3 4bdedea4,
  P4 system.configuration, P5 2.0.0.0, P6 4889de74, P7 1a6, P8 136,
  P9 ioibmurhynrxkw0zxkyrvfn0boyyufow, P10 NIL.

Well...great information. After a lot of searching I finally was able to get further information about this exception (by adding a handler for UnhandledExceptions directly in My.MyApplication.New(), Application.Designer.vb):

  System.Configuration.ConfigurationErrorsException

  Configuration system failed to initialize

     at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
     at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
     at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
     at System.Configuration.ConfigurationManager.GetSection(String sectionName)
     at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
     at System.Net.Configuration.SettingsSectionInternal.get_Section()
     at System.Net.Sockets.Socket.InitializeSockets()
     at System.Net.Sockets.Socket.get_SupportsIPv4()
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.get_HostName()
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(Boolean SecureChannel)
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
     at MyAppNameHere.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Line 81.

And at this point I'm stuck...I'm out of ideas. I'm not using any kind of configuration system from the framework (no reference to System.Configuration, and there never was a MyAppnameHere.exe.config generated or distributed, nor have I seen this error before). I also found a bug report at Microsoft (Google Cache) about this bug (in another context, though). But as it seems, they won't even look at it.

Every help is greatly appreciated!

Edit: I'm using Visual Studio 2008 Prof.. Crash happens in Release- and Debug-Build on the client machine. Debugging the application directly on this machine is out of question I fear, 300+ Miles and they only have two computers to work with.

Edit2: Other .NET applications are working fine.

Edit3: After Andrey pointed it out, I also had a look at the Inner-Exception (I always forget that this thing exists):

  System.Configuration.ConfigurationErrorsException

  Unknown configraution directive "system.serviceModel". (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 145)

     at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
     at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
     at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
     at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

I removed this section and everything is now working es expected...but now one question is haunting me: Why did other applications work?


Solution

  • That error indicates there is something wrong with a .config file. This could be the application's config file, or maybe machine.config.

    I'd suggest uninstalling/reinstalling .net on that machine.


    Another thing to try is to see if the user can run your app as elevated (run as administrator). The config system may be trying to access a file that the user doesn't have rights to. If they can run as admin, figure out what files are accessed by the config system and then instruct the user to allow their account rights to those files.