Bug 8536 - System.Configuration.IgnoreSectionHandler causes sections to be ignored
Summary: System.Configuration.IgnoreSectionHandler causes sections to be ignored
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-21 04:44 UTC by Llewellyn Pritchard
Modified: 2012-11-21 06:52 UTC (History)
2 users (show)

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


Attachments

Description Llewellyn Pritchard 2012-11-21 04:44:36 UTC
Hi

When using IgnoreSectionHandler (ie for log4net) any sections after the ignored section is also ignored.

The following works and the bindingRedirect is successful:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
  </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="2.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>
</configuration>

When changing it to have the runtime section after log4net, it is simply ignored and bindingRedirect fails:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
  </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>

  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />
        <bindingRedirect oldVersion="2.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

</configuration>

Running Mono 3.0.1 compiled from source on Ubuntu 11.04 amd64.

I tried to debug the issue, but gdb explodes seemingly when reading the .config (whether it contains log4net or not).

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7221720 in memcpy () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) c
Continuing.
Stacktrace:

  at <unknown> <0xffffffff>
  at System.Xml.XmlInputStream.Initialize (System.IO.Stream) [0x001cc] in /home/agentx/mono-3.0.1/mcs/class/System.XML/System.Xml/XmlInputStream.cs:438
  at System.Xml.XmlInputStream..ctor (System.IO.Stream) [0x00006] in /home/agentx/mono-3.0.1/mcs/class/System.XML/System.Xml/XmlInputStream.cs:354
  at (wrapper remoting-invoke-with-check) System.Xml.XmlInputStream..ctor (System.IO.Stream) <IL 0x00020, 0xffffffff>
  at System.Xml.XmlStreamReader..ctor (System.IO.Stream) [0x00000] in /home/agentx/mono-3.0.1/mcs/class/System.XML/System.Xml/XmlInputStream.cs:50
  at (wrapper remoting-invoke-with-check) System.Xml.XmlStreamReader..ctor (System.IO.Stream) <IL 0x00020, 0xffffffff>
  at System.Xml.XmlTextReader..ctor (System.IO.Stream) [0x00000] in /home/agentx/mono-3.0.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:71
  at ConfigXmlTextReader..ctor (System.IO.Stream,string) [0x00000] in /home/agentx/mono-3.0.1/mcs/class/System.Configuration/System.Configuration/ConfigXmlTextReader.cs:40
  at System.Configuration.Configuration.Load () [0x00045] in /home/agentx/mono-3.0.1/mcs/class/System.Configuration/System.Configuration/Configuration.cs:492
  at System.Configuration.Configuration.Init (System.Configuration.Internal.IConfigSystem,string,System.Configuration.Configuration) [0x00065] in /home/agentx/mono-3.0.1/mcs/class/System.Configuration/System.Configuration/Configuration.cs:137
...

Cheers

Llewellyn
Comment 1 Zoltan Varga 2012-11-21 06:52:00 UTC
-> System.Configuration.

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