This documentation is archived and is not being maintained.

TypeBuilder.IsSecurityCritical Property

Gets a value that indicates whether the current type is security-critical or security-safe-critical, and therefore can perform critical operations.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public override bool IsSecurityCritical { get; }

Property Value

Type: System.Boolean
true if the current type is security-critical or security-safe-critical; false if it is transparent.


The current dynamic type has not been created by calling the CreateType method.

The IsSecurityCritical, IsSecuritySafeCritical, and IsSecurityTransparent properties report the transparency level of the type, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

Security level
















Using these properties is much simpler than examining the security annotations of an assembly and its types, checking the current trust level, and attempting to duplicate the runtime's rules.

The runtime begins evaluating transparency levels at the assembly. For example, if the dynamic assembly is security-critical, annotations on types are ignored, and all types are security-critical.

By default, a dynamic assembly inherits the transparency of the assembly that emits it. You can override this default by using the AppDomain.DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>), AppDomain.DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Boolean, IEnumerable<CustomAttributeBuilder>), or AppDomain.DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Evidence, PermissionSet, PermissionSet, PermissionSet, Boolean, IEnumerable<CustomAttributeBuilder>) method overload and specifying security attributes. You cannot elevate security levels by doing this; that is, transparent code cannot emit security-critical or security-safe-critical code. Attributes must be specified when the dynamic assembly is created, or they do not take effect until the assembly has been saved to disk and reloaded.


Default inheritance is limited to the runtime's evaluation of transparency. No attributes are applied to the dynamic assembly. If you want to add security attributes, you must apply them yourself.

For more information about reflection emit and transparency, see Security Issues in Reflection Emit. For information about transparency, see Security Changes in the .NET Framework 4.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.