http://bugzilla.novell.com/show_bug.cgi?id=607832

http://bugzilla.novell.com/show_bug.cgi?id=607832#c0


           Summary: Different behaviour of configuration classes on .NET
                    and MONO
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Configuration
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


Created an attachment (id=363780)
 --> (http://bugzilla.novell.com/attachment.cgi?id=363780)
Unit tests

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729; .NET4.0E)

Attached unit tests reproduces tow bugs
1.TestCustomConfigurationSectionValidSection. This test contains code, that
uses dynamic configuration property creation.
2.TestCustomConfigurationSectionInvalidSection this test uses same code, but
it's "negative" test for dynamic configuration property creation.

P.S.
As I see first test failed because Microsoft .NET checks for properties to
process in beginning of DeserializeElement 
<code desc="code from Reflector"> 

public abstract class ConfigurationElement{
    .....
    protected internal virtual void DeserializeElement(XmlReader reader, bool
serializeCollectionKey)
    {
        ConfigurationPropertyCollection properties = this.Properties;
        ......
              while (reader.MoveToNextAttribute())
            {
            string name = reader.Name;
            ......
            ConfigurationProperty prop = (properties != null) ?
properties[name] : null;
            ......

        }
        ......
    }
    ......
}

</code> 

Mono uses cached list of properties. If cache was create before properties was
added - test failed.
<code desc="code from ConfigurationElement.cs">

public abstract class ConfigurationElement
{
    .....
    protected internal virtual void DeserializeElement (XmlReader reader, bool
serializeCollectionKey)
    {
        Hashtable readProps = new Hashtable ();

        reader.MoveToContent ();
        while (reader.MoveToNextAttribute ())
        {
            PropertyInformation prop = ElementInformation.Properties
[reader.LocalName];
        .....
        }
        ....
    }
    .....
}
</code>

As I see second test failed because of Microsoft .NET runtime wraps all
exception during section creation with 

<code desc="code from Reflector">
internal static class ExceptionUtil{
    ...

    internal static ConfigurationErrorsException WrapAsConfigException(string
outerMessage, Exception e, string filename, int line)
    {
        ConfigurationErrorsException exception = e as
ConfigurationErrorsException;
        if (exception != null)
        {
            return exception;
        }
        ConfigurationException exception2 = e as ConfigurationException;
        if (exception2 != null)
        {
            return new ConfigurationErrorsException(exception2);
        }
        XmlException inner = e as XmlException;
        if (inner != null)
        {
            if (inner.LineNumber != 0)
            {
                line = inner.LineNumber;
            }
            return new ConfigurationErrorsException(inner.Message, inner,
filename, line);
        }
        if (e != null)
        {
            return new
ConfigurationErrorsException(SR.GetString("Wrapped_exception_message", new
object[] { outerMessage, e.Message }), e, filename, line);
        }
            return new
ConfigurationErrorsException(SR.GetString("Wrapped_exception_message", new
object[] { outerMessage, NoExceptionInformation }), filename, line);
    }
    ...
}

</code>




Reproducible: Always

Steps to Reproduce:
1.Run unit tests

Actual Results:  
Tests failed on Mono 2.6.4

Expected Results:  
Tests passed on Mono 2.6.4

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to