[ 
https://issues.apache.org/jira/browse/LOG4NET-545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15823216#comment-15823216
 ] 

Stefan Bodewig commented on LOG4NET-545:
----------------------------------------

No idea, but I'm not surprised reflection works differently in details for the 
full framework from .NET Core. I'll close this issue as "not a bug".

> Inheriting from BufferingForwardingAppender throws in .NET Core
> ---------------------------------------------------------------
>
>                 Key: LOG4NET-545
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-545
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0.7
>            Reporter: Nima Ara
>            Priority: Critical
>
> I am in the process of migrating [Easy.Logger | 
> https://github.com/NimaAra/Easy.Logger] to _.NET Core_.
> When inheriting from the {{BufferingForwardingAppender}}:
> {code}
> public sealed class MyAppender : BufferingForwardingAppender
> {
>       protected override void SendBuffer(LoggingEvent[] events)
>       {
>               base.SendBuffer(events);
>       }
> }
> {code}
> Using the following config:
> {code:xml}
> <?xml version="1.0" encoding="utf-8" ?>
> <log4net>
>   <root>
>     <level value="ALL"/>
>     <appender-ref ref="MyBufferingAppender"/>    
>   </root>
>   <appender name="MyBufferingAppender" type="SomeNamespace.MyAppender">
>     <lossy value="false" />
>     <bufferSize value="512" />
>     <appender-ref ref="RollingFile"/>
>   </appender>
> ... rolling file appender skipped ...
> </log4net>
> {code}
> Throws:
> {code:none}
> log4net:ERROR Could not create Appender [MyBufferingAppender] of type 
> [SomeNamespace.MyAppender]. Reported error follows.
> System.TypeLoadException: Could not load type 'SomeNamespace.MyAppender' from 
> assembly 'log4net, Version=2.0.7.0, Culture=neutral, 
> PublicKeyToken=669e0ddf0bb1aa2a'.
>    at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, 
> String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack 
> type, ObjectHandleOnStack keepAlive)
>    at System.Reflection.RuntimeAssembly.GetType(String name, Boolean 
> throwOnError, Boolean ignoreCase)
>    at 
> log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement
>  appenderElement)
> log4net:ERROR Appender named [MyBufferingAppender] not found.
> {code}
> The same code and config runs fine in the full framework.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to