SuppressUnmanagedCodeSecurityAttribute 클래스

정의

스택 워크를 사용하지 않고 관리하는 코드를 관리하지 않는 코드로 호출할 수 있습니다. 이 클래스는 상속될 수 없습니다.

public ref class SuppressUnmanagedCodeSecurityAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)>]
type SuppressUnmanagedCodeSecurityAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)>]
type SuppressUnmanagedCodeSecurityAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SuppressUnmanagedCodeSecurityAttribute = class
    inherit Attribute
Public NotInheritable Class SuppressUnmanagedCodeSecurityAttribute
Inherits Attribute
상속
SuppressUnmanagedCodeSecurityAttribute
특성

설명

중요

부분적으로 신뢰할 수 있는 코드는 더 이상 지원되지 않습니다. 이 특성은 .NET Core에 영향을 주지 않습니다.

주의

이 특성은 매우 주의하여 사용합니다. 잘못된 사용은 보안 약점을 만들 수 있습니다.

이 특성은 그렇게 할 때 런타임 보안 검사의 성능 손실을 발생시키지 않고 네이티브 코드를 호출하려는 메서드에 적용할 수 있습니다. 관리되지 않는 코드를 호출할 때 수행되는 스택 워크는 런타임에 생략되므로 성능이 크게 절감됩니다. 클래스에서 이 특성을 사용하면 포함된 모든 메서드에 적용됩니다.

일반적으로 관리 코드가 관리되지 않는 코드(PInvoke 또는 COM interop에서 네이티브 코드로)를 호출할 때마다 모든 호출자에게 이를 허용하는 데 필요한 권한이 있는지 확인하는 권한이 필요합니다 UnmanagedCode . 개발자는 이 명시적 특성을 적용하여 런타임에 수요를 억제할 수 있습니다. 개발자는 관리되지 않는 코드로의 전환이 다른 수단으로 충분히 보호되도록 해야 합니다. 사용 권한에 대한 UnmanagedCode 요청은 링크 시간에 계속 발생합니다. 예를 들어 함수 A가 함수 B를 호출하고 함수 B가 표시된 SuppressUnmanagedCodeSecurityAttribute경우 함수 A는 Just-In-Time 컴파일 중에 관리되지 않는 코드 권한을 확인하지만 런타임 중에는 관리되지 않습니다.

이 특성은 PInvoke 메서드(또는 PInvoke 메서드를 포함하는 클래스) 또는 interop 호출을 수행할 인터페이스의 정의에 적용되는 경우에만 효과적입니다. 다른 모든 컨텍스트에서는 무시됩니다.

이 특성은 관리되지 않는 코드를 통해 시스템 리소스에 대한 액세스를 제공하는 클래스를 구현하는 데 유용합니다. 관리되지 않는 코드에 액세스할 수 있는 권한이 없는 코드는 이 특성이 있는 클래스를 호출하여 관리되지 않는 코드에 액세스할 수 있습니다. 이 특성이 있는 클래스의 작성자가 클래스의 보안을 프로그래밍한 경우에만 안전합니다. 그렇지 않은 경우 이 특성은 위험하며 이 특성을 사용하는 코드가 오용되도록 허용할 수 있습니다.

선언적 보안 특성이 아니라 일반 특성( Attribute이 특성은 파생되지 않음 SecurityAttribute)입니다.

생성자

SuppressUnmanagedCodeSecurityAttribute()

SuppressUnmanagedCodeSecurityAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보