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

Dominik Psenner edited comment on LOG4NET-611 at 9/27/18 6:50 AM:
------------------------------------------------------------------

After some research I do now know that this issue is introduced by attempting 
to fix LOG4NET-347. LOG4NET-347 was about allowing log4net to work in partially 
trusted environments like asp.net. The mutex is just another symptom of a more 
generic problem caused by the addition of the 
System.Security.AllowPartiallyTrustedCallers attribute.

I wonder what happens if we remove that attribute for NETSTANDARD1_3 and 
someone references the netstandard assembly from an asp.net application. Would 
it still work? Do we have to remark that log4net cannot be used when built 
against netstandard and consumed by an application that runs in an asp.net 
environment meaning that the log4net flavor built against the full framework 
must be used instead?

[~andrei_s], would you volunteer to investigate?


was (Author: nachbarslumpi):
After some research I do now know that this issue is introduced by attempting 
to fix LOG4NET-347. LOG4NET-347 was about allowing log4net to work in partially 
trusted environments like asp.net. The mutex is just another symptom of a more 
generic problem caused by the addition of the 
System.Security.AllowPartiallyTrustedCallers attribute.

I wonder what happens if we remove that attribute for NETSTANDARD1_3 and 
someone references the netstandard assembly from an asp.net application. Would 
it still work? Do we have to remark that log4net cannot be used when built 
against netstandard and consumed by an application that runs in an asp.net 
environment meaning that the log4net flavor built against the full framework 
must be used instead?

> Failed to create netstandard version of logger
> ----------------------------------------------
>
>                 Key: LOG4NET-611
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-611
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.8
>         Environment: Windows Server 2010 R2
>            Reporter: Andrei Stryia
>            Assignee: Dominik Psenner
>            Priority: Critical
>              Labels: RollingFileAppender
>
> I'm using netstandard version of the logger which is constantly fails wit 
> error:
> {code:java}
> System.MethodAccessException: Attempt by security transparent method 
> 'log4net.Appender.RollingFileAppender.ActivateOptions()' to access security 
> critical method 'System.Threading.Mutex..ctor(Boolean, System.String)' failed.
> Assembly 'log4net, Version=2.0.8.0, Culture=neutral, 
> PublicKeyToken=669e0ddf0bb1aa2a' is marked with the 
> AllowPartiallyTrustedCallersAttribute, and uses the level 2 security 
> transparency model. Level 2 transparency causes all methods in 
> AllowPartiallyTrustedCallers assemblies to become security transparent by 
> default, which may be the cause of this exception.
>  at log4net.Appender.RollingFileAppender.ActivateOptions()
>  at Log.CreateTimestampedFileAppender(LoggingSettings settings)
>  at Log.InitForComponent(String componentName, LoggingSettings settings)
> ...
> {code}
> My logger assembly is a netstandard asembly which is using by .net framework 
> console app.
> Error disappears, when I'm replacing log4net netstandard1.3 version by 
> net45-full



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to