Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:26:19+00:00 2026-05-28T01:26:19+00:00

https://github.com/apache/log4net I am compiling log4net from the source above, but it doesn’t pass verification:

  • 0

https://github.com/apache/log4net

I am compiling log4net from the source above, but it doesn’t pass verification:

[IL]: Error: [log4net.dll : log4net.Plugin.RemoteLoggingServerPlugin::Attach][offset 0x00000029] Method is not visible.

Code is ok:

public interface ILoggerRepository
{
    ...
}

public interface IPlugin
{
    void Attach(ILoggerRepository repository);
}

public abstract class PluginSkeleton : IPlugin
{
    public virtual void Attach(ILoggerRepository repository) { }
}

public class RemoteLoggingServerPlugin : PluginSkeleton
{
    override public void Attach(ILoggerRepository repository)
    {
        base.Attach(repository);
        ...
    }
}

https://github.com/apache/log4net/blob/trunk/src/Plugin/IPlugin.cs

https://github.com/apache/log4net/blob/trunk/src/Plugin/PluginSkeleton.cs

https://github.com/apache/log4net/blob/trunk/src/Plugin/RemoteLoggingServerPlugin.cs

Investigation shows that it fails in calling RemotingServices.Marshal():

override public void Attach(ILoggerRepository repository)
{
    base.Attach(repository);

    // Create the sink and marshal it
    m_sink = new RemoteLoggingSinkImpl(repository);

    try
    {
         **RemotingServices.Marshal(m_sink, m_sinkUri, typeof(IRemoteLoggingSink));**
    }
    catch(Exception ex)
    {
        LogLog.Error(declaringType, "Failed to Marshal remoting sink", ex);
    }
}

But there is nothing crucial here. Moreover calling RemotingServices.Marshal() with any type leads to the same problems:

Even if I change the Attach() to this:

override public void Attach(ILoggerRepository repository)
{
    RemotingServices.Marshal(null, null, typeof(int));
}

Can someone spot what is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:26:20+00:00Added an answer on May 28, 2026 at 1:26 am

    The problem is related to the fact that with .NET 4 Level 2 transparency was introduced. (See http://msdn.microsoft.com/en-us/library/dd233102.aspx for details.)

    The method override public void Attach(ILoggerRepository repository) is lacking the SecuritySafeCriticalAttribute. Adding the attribute:

    #if NET_4_0
        [System.Security.SecuritySafeCritical]
    #endif
        override public void Attach(ILoggerRepository repository)
        {
            // ...
        }
    

    will make the IL verification pass. (Also see: http://msdn.microsoft.com/en-us/library/bb397858.aspx for further information.)

    Update: To shed some more light on why verification fails (which might not be immediately clear by just reading the articles in the links provided) here is a short explanation.

    RemotingServices.Marshal has the [SecuritySafeCritical] attribute applied. So one would assume that calling the method from a transparent method would be allowed. However RemotingServices.Marshal returns an object of type System.Runtime.Remoting.ObjRef and said type is annotated with the [SecurityCritical] attribute.
    If the log4net code would store a reference to the returned value in a local variable, Code Analysis would detect the error and issue a CA2140 warning (“Transparent code must not reference security critical items”).
    Now apparently under the security transparency rules, a transparent method may not call a security safe-critical method if the called method returns a security critical type even if the transparent method does not store a reference to the returned object as the following sample demonstrates:

    public class TransparencyRulesDemo
    {
        [SecuritySafeCritical]
        public void SafeGetCritical()
        {
            GetCritical();
        }
    
        public void TransparentGetCritical()
        {
            // Below line will trigger a CA2140 warning if uncommented...
            // var critical = GetCritical();
    
            // ...the following line on the other hand will not produce any warning
            // but will lead to IL verification errors and MethodAccessExceptions if
            // called from transparent code.
            GetCritical();
        }
    
        [SecuritySafeCritical]
        public Critical GetCritical()
        {
            return new Critical();
        }
    }
    
    [SecurityCritical]
    public class Critical
    {
    
    } 
    

    This btw. makes the [SecuritySafeCritical] attribute on RemotingServices.Marshal kind of pointless.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I downloaded Flume source from: https://github.com/cloudera/flume/tarball/release-0.9.4 I'm getting a NullPointerException, shown below. If anyone
I'm using clearance ( https://github.com/thoughtbot/clearance/wiki ) for authentication in my rails app. But I'm
I downloaded the JSON2.js from https://github.com/douglascrockford/JSON-js/blob/master/json2.js and it does not have implementation for JSON2.stringify()
https://github.com/ajaxorg/ace/wiki/Embedding---API editor.session.on('change', callback); is how you bind an event to change. But how do
I'm using Cufon ( https://github.com/sorccu/cufon/wiki/about ) to use special fonts in my website. But
in the rails source : https://github.com/rails/rails/blob/master/activesupport/lib/active_support/lazy_load_hooks.rb the following can be seen @load_hooks = Hash.new
rowanparker https://github.com/rowanparker/kohana-3-paypal I really need this module but I can not use it because
(NOTE: Source code here https://github.com/cthielen/dss-evote ) I've got a simple voting application. A survey
I'm trying to install nodejs and apache on the same server following this: https://gist.github.com/754303
https://github.com/ether/pad/tree/master/etherpad If you click on that, then go to bin, the URL changes, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.