[Mono-bugs] [Bug 388305] New: System.Configuration problem with <trace> in <system. diagnostics>

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 8 12:03:13 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=388305


           Summary: System.Configuration problem with <trace> in
                    <system.diagnostics>
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Configuration
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: martin at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


If you run the following in the debugger:

=====
using System;
using System.Configuration;
using System.Diagnostics;

class X
{
        static void Main ()
        {
                object o = ConfigurationManager.GetSection
("system.diagnostics");
                Console.WriteLine (o);
        }
}
=====

there's an exception thrown:

======
Starting program: ./test/E.exe 
Thread @1 stopped at #0: 0x400102fa in X.Main()+0xa at
/work/kahalo/debugger/test/E.cs:9.
   9            object o = ConfigurationManager.GetSection
("system.diagnostics");
(mdb) catch Exception
Inserted catch point 4 for System.Exception
(mdb) c
Thread @1 caught exception at #0: 0x40244105 in
System.Configuration.ConfigurationElement.DeserializeElement(System.Xml.XmlReader,
bool)+0xa55 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs:372.
 372                                                    throw new
ConfigurationException ("Unrecognized element '" + reader.LocalName + "'.");
(mdb) bt
(*) #0: 0x40244105 in
System.Configuration.ConfigurationElement.DeserializeElement(System.Xml.XmlReader,
bool)+0xa55 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs:372
    #1: 0x402433b1 in
System.Configuration.ConfigurationSection.DoDeserializeSection(System.Xml.XmlReader)+0x221
at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:168
    #2: 0x40242ea1 in
System.Configuration.ConfigurationSection.GetRuntimeObject()+0x131 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:81
    #3: 0x40242e01 in
System.Configuration.ConfigurationSection.GetRuntimeObject()+0x91 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:73
    #4: 0x40242e01 in
System.Configuration.ConfigurationSection.GetRuntimeObject()+0x91 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:73
    #5: 0x40242e01 in
System.Configuration.ConfigurationSection.GetRuntimeObject()+0x91 at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs:73
    #6: 0x40240f9a in
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(string)+0x4a
at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:57
    #7: 0x4001036e in
System.Configuration.ConfigurationManager.GetSection(string)+0x2e at
/work/kahalo/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:164
    #8: 0x40010307 in X.Main()+0x17 at /work/kahalo/debugger/test/E.cs:9
======

It fails to parse the `trace' element.

If you go a few frames up, it's here:

=====
  80 
  81                                    DoDeserializeSection (reader);
  82                                    if (!String.IsNullOrEmpty
(SectionInformation.ConfigSource)) {
  83                                            string fileDir =
SectionInformation.ConfigFilePath;
  84                                            if (!String.IsNullOrEmpty
(fileDir))
  85                                                    fileDir =
Path.GetDirectoryName (fileDir);
  86                                            else
  87                                                    fileDir = String.Empty;
  88 
  89                                            string path = Path.Combine
(fileDir, SectionInformation.ConfigSource);
  90                                            if (File.Exists (path)) {
  91                                                    RawXml =
File.ReadAllText (path);
  92                                                   
SectionInformation.SetRawXml (RawXml);
  93                                            }
  94                                    }
  95                            } catch {
  96                                    // ignore, it can fail - we deserialize
only in order to get
  97                                    // the configSource attribute
  98                            }
======

So the exception is silently ignored.

Is this a bug or a feature ?

Note that you will only be able to reproduce this when running inside the
debugger and you need to use `catch Exception' to make the debugger stop when
any exception is thrown.

Martin


-- 
Configure bugmail: https://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.


More information about the mono-bugs mailing list