Gets a value that indicates whether the current type is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.
public:
virtual property bool IsSecurityCritical { bool get(); };
public virtual bool IsSecurityCritical { get; }
member this.IsSecurityCritical : bool
Public Overridable ReadOnly Property IsSecurityCritical As Boolean
Property Value
true
if the current type is security-critical or security-safe-critical at the current trust level; false
if it's transparent.
The IsSecurityCritical, IsSecuritySafeCritical, and IsSecurityTransparent properties report the transparency level of the type at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:
Security level IsSecurityCritical IsSecuritySafeCritical IsSecurityTransparent Criticaltrue
false
false
Safe critical true
true
false
Transparent false
false
true
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.
Important
For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the Assembly.IsFullyTrusted and AppDomain.IsFullyTrusted properties.
For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes.
See alsoCollaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4