Plug problem (internal class/parameters)

Sep 11, 2011 at 11:50 AM
Edited Sep 11, 2011 at 11:52 AM

Hi,

I have a problem to implement a plug for an internal class with internal parameters. Every time i get the error "plug needed"!
How can I implement this method (Need this for Threading)?

The Error:

 

Fehler 5 Plug needed. System.Void System.Security.CodeAccessSecurityEngine.SpecialDemand(System.Security.PermissionType, &System.Threading.StackCrawlMark)

Prototypes:

 

internal enum PermissionType
{
...
}

internal enum StackCrawlMark
{
...
}

static internal extern void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark);

 

(Source: http://labs.developerfusion.co.uk/SourceViewer/view/SSCLI/System.Security/CodeAccessSecurityEngine/12945/) 

 

My Implementation:

 

namespace ShadowOS.Plugs
{
    [Serializable()]
    public enum PermissionType
    {
        SecurityUnmngdCodeAccess = 0,
        SecuritySkipVerification = 1,
        ReflectionTypeInfo = 2,
        SecurityAssert = 3,
        ReflectionMemberAccess = 4,
        SecuritySerialization = 5,
        ReflectionEmit = 6,
        FullTrust = 7,
        SecurityBindingRedirects = 8,
        UIPermission = 9,
        EnvironmentPermission = 10,
        FileDialogPermission = 11,
        FileIOPermission = 12,
        ReflectionPermission = 13,
        SecurityPermission = 14,
        SecurityControlEvidence = 16,
        SecurityControlPrincipal = 17
    }

    [Serializable()]
    public enum StackCrawlMark
    {
        LookForMe = 0,
        LookForMyCaller = 1,
        LookForMyCallersCaller = 2,
        LookForThread = 3
    }

    [Plug(TargetName = "System.Security.CodeAccessSecurityEngine")] 
    public static class CodeAccessSecurityEnginePlug
    {
        //public static void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark) // Don't Work (Plug Need Error)
        //public static void SpecialDemand(Object whatPermission, ref Object stackMark) // Don't Work (Plug Need Error)
        public static void SpecialDemand(System.Security.PermissionType whatPermission, ref System.Threading.StackCrawlMark stackMark) // Don't Work (Access Error)
        {
        }
    }
}

 

Coordinator
Sep 11, 2011 at 12:17 PM
Plug the method up the tree: you're trying to use CAS, which we dont support at all, so best to find some other way to use it..


On Sun, Sep 11, 2011 at 12:50 PM, The_Shadow3 <notifications@codeplex.com> wrote:

From: The_Shadow3

Hi,

I have a problem to implement a plug for an internal class with internal parameters. Every time i get the error "plug needed"!
How can I implement this method?

The Error:

Fehler 5 Plug needed. System.Void System.Security.CodeAccessSecurityEngine.SpecialDemand(System.Security.PermissionType, &System.Threading.StackCrawlMark)

Prototypes:

internal enum PermissionType
{
...
}

internal enum StackCrawlMark
{
...
}
static internal extern void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark);

(Source: http://labs.developerfusion.co.uk/SourceViewer/view/SSCLI/System.Security/CodeAccessSecurityEngine/12945/)

My Implementation:

namespace ShadowOS.Plugs
{
    [Serializable()]
    public enum PermissionType
    {
        SecurityUnmngdCodeAccess = 0,
        SecuritySkipVerification = 1,
        ReflectionTypeInfo = 2,
        SecurityAssert = 3,
        ReflectionMemberAccess = 4,
        SecuritySerialization = 5,
        ReflectionEmit = 6,
        FullTrust = 7,
        SecurityBindingRedirects = 8,
        UIPermission = 9,
        EnvironmentPermission = 10,
        FileDialogPermission = 11,
        FileIOPermission = 12,
        ReflectionPermission = 13,
        SecurityPermission = 14,
        SecurityControlEvidence = 16,
        SecurityControlPrincipal = 17
    }

    [Serializable()]
    public enum StackCrawlMark
    {
        LookForMe = 0,
        LookForMyCaller = 1,
        LookForMyCallersCaller = 2,
        LookForThread = 3
    }

    [Plug(TargetName = "System.Security.CodeAccessSecurityEngine")] 
    public static class CodeAccessSecurityEnginePlug
    {
        //public static void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark) // Don't Work (Plug Need Error)
        //public static void SpecialDemand(Object whatPermission, ref Object stackMark) // Don't Work (Plug Need Error)
        public static void SpecialDemand(System.Security.PermissionType whatPermission, ref System.Threading.StackCrawlMark stackMark) // Don't Work (Access Error)
        {
        }
    }
}

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com