Bug 9521 - Crash in Properties.Settings.Default.Save()
Summary: Crash in Properties.Settings.Default.Save()
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-12 23:13 UTC by Steve
Modified: 2014-05-23 16:45 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Archive of a project that reproduces the problem (5.81 KB, application/x-bzip2)
2013-01-12 23:13 UTC, Steve
Details
Test Case from Case #44169 (10.24 KB, application/zip)
2013-08-19 17:04 UTC, Allie Miller
Details
Screencast (5.50 MB, application/octet-stream)
2013-08-20 18:53 UTC, Nikolay Ivanets
Details

Description Steve 2013-01-12 23:13:09 UTC
Created attachment 3205 [details]
Archive of a project that reproduces the problem

I just built the latest Mono from the trunk, and ran one of my applications, and it crashed immediately inside of Properties.Settings.Default.Save().

Blessedly, I was able to trim my application's project down to the bare minimum to reproduce the bug!  Enclosed is a directory tree with a MonoDevelop project that, when built, will lead to an unhandled exception deep inside of System.Configuration:

System.NotImplementedException: The requested feature is not implemented.
  at System.Configuration.SettingValueElement.Unmerge (System.Configuration.ConfigurationElement sourceElement, System.Configuration.ConfigurationElement parentElement, ConfigurationSaveMode saveMode) [0x00000] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System/System.Configuration/SettingValueElement.cs:115
  at System.Configuration.ConfigurationElement.Unmerge (System.Configuration.ConfigurationElement source, System.Configuration.ConfigurationElement parent, ConfigurationSaveMode updateMode) [0x00149] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs:593
  at System.Configuration.ConfigurationElementCollection.Unmerge (System.Configuration.ConfigurationElement sourceElement, System.Configuration.ConfigurationElement parentElement, ConfigurationSaveMode updateMode) [0x00053] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/ConfigurationElementCollection.cs:571
  at System.Configuration.ConfigurationElement.Unmerge (System.Configuration.ConfigurationElement source, System.Configuration.ConfigurationElement parent, ConfigurationSaveMode updateMode) [0x00149] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs:593
  at System.Configuration.ConfigurationSection.SerializeSection (System.Configuration.ConfigurationElement parentElement, System.String name, ConfigurationSaveMode saveMode) [0x0001a] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:233
  at System.Configuration.SectionInfo.WriteData (System.Configuration.Configuration config, System.Xml.XmlWriter writer, ConfigurationSaveMode mode) [0x0002e] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/SectionInfo.cs:196
  at System.Configuration.SectionGroupInfo.WriteContent (System.Xml.XmlWriter writer, System.Configuration.Configuration config, ConfigurationSaveMode mode, Boolean writeElem) [0x00059] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:399
  at System.Configuration.SectionGroupInfo.WriteData (System.Configuration.Configuration config, System.Xml.XmlWriter writer, ConfigurationSaveMode mode) [0x0000c] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:389
  at System.Configuration.SectionGroupInfo.WriteContent (System.Xml.XmlWriter writer, System.Configuration.Configuration config, ConfigurationSaveMode mode, Boolean writeElem) [0x00059] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:399
  at System.Configuration.SectionGroupInfo.WriteRootData (System.Xml.XmlWriter writer, System.Configuration.Configuration config, ConfigurationSaveMode mode) [0x00000] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:383
  at System.Configuration.Configuration.SaveData (System.Xml.XmlTextWriter tw, ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00000] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:487
  at System.Configuration.Configuration.Save (System.IO.Stream stream, ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00117] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:475
  at System.Configuration.Configuration.Save (ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00066] in /home/sboswell/rpmbuild/BUILD/mono-3.0.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:409


I'm running Fedora Core 17.
Comment 1 Allie Miller 2013-08-19 17:04:23 UTC
Created attachment 4663 [details]
Test Case from Case #44169
Comment 3 Nikolay Ivanets 2013-08-20 18:53:07 UTC
Created attachment 4681 [details]
Screencast

I have recorded a screencast to prove the bug.
Take a look please.

Here is source code of SettingValueElement.cs in 3.2.1 branch.
As you can see NotImplementedException exception is thrown on line 115: https://github.com/mono/mono/blob/mono-3.2.1-branch/mcs/class/System/System.Configuration/SettingValueElement.cs

However, the same line is present in 2.10.12 (where bug is not reproducible): https://github.com/mono/mono/blob/mono-2.10.12/mcs/class/System/System.Configuration/SettingValueElement.cs

I can suspect that something was changed and it leads to call unimplemented method in 3.2.1 branch.
Comment 4 hmgoossen 2013-09-10 17:17:30 UTC
The same issue is reproducible on OpenSUSE 12.3

> cat /etc/SuSE-release
openSUSE 12.3 (x86_64)
VERSION = 12.3
CODENAME = Dartmouth

Mono version 3.0.4

> mono --version
Mono JIT compiler version 3.0.4 (tarball Thu Mar  7 10:40:07 UTC 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
Comment 5 Steve 2013-10-13 22:37:01 UTC
After several hours of "git bisect", I've located the change that caused this problem:

0b57238424265deb24a4c047a80da23501f9f240 is the first bad commit
commit 0b57238424265deb24a4c047a80da23501f9f240
Author: Martin Baulig <...>
Date:   Fri Dec 21 10:05:00 2012 +0100

    [System.Configuration]: SaveMode and UserLevel.
    
    * Configuration.Save() and SaveAs() now honors the
      `ConfigurationSaveMode' argument.
    
    * Check whether the file has been modified prior to saving.
    
    * Fix ConfigurationUserLevel inheritance.
    
    * Implement ConfigurationElement.IsModified().
    
    * New ConfigurationSaveTest.cs test:
    
      - load a custom section using different parent configuration
        files using ExeConfigurationFileMap and different
        ConfigurationUserLevel values.
    
      - save configuration using different ConfigurationSaveMode
        arguments and different inherited parent configurations.
    
    * ExeConfigurationFileMapTest.cs: Add error checks for missing
      required filenames.
    
    * New TestUtil.cs helper class:
    
      - RunWithTempFile() and RunWithTempFiles() helper functions.
      - DotNetVersion, ThisDllName and ThisConfigFileName properties,
        moving all the #ifdef's into one central place.

Note You need to log in before you can comment on or make changes to this bug.