Serves as a container for application-wide types and type members whose metadata is available for reflection at run time, and applies runtime reflection policy to all the program elements in an app.
<Application> Element (rd.xml)
<Application Activate="policy_setting" Browse="policy_setting" Dynamic="policy_setting" Serialize="policy_setting" DataContractSerializer="policy_setting" DataContractJsonSerializer="policy_setting" XmlSerializer="policy_setting" MarshalObject="policy_setting" MarshalDelegate="policy_setting" MarshalStructure="policy_setting" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements. In the Child Elements table, policy refers to the kind of metadata that is made available for particular program elements at run time.
||Reflection||Optional attribute. Controls runtime access to constructors to enable activation of instances.|
||Reflection||Optional attribute. Controls querying for information about or enumerating the types, but does not enable any dynamic access at run time.|
||Reflection||Optional attribute. Controls runtime access to all type members, including constructors, methods, fields, properties, and events, to enable dynamic programming.|
||Serialization||Optional attribute. Controls runtime access to constructors, fields, and properties, to enable type instances to be serialized and deserialized by libraries such as the Newtonsoft JSON serializer.|
||Serialization||Optional Attribute. Controls policy for serialization that uses the System.Runtime.Serialization.DataContractSerializer class.|
||Serialization||Optional Attribute. Controls policy for JSON serialization that uses the System.Runtime.Serialization.Json.DataContractJsonSerializer class.|
||Serialization||Optional Attribute. Controls policy for XML serialization that uses the System.Xml.Serialization.XmlSerializer class.|
||Interop||Optional Attribute. Controls policy for marshaling reference types to Windows Runtime and COM.|
||Interop||Optional Attribute. Controls policy for marshaling delegate types as function pointers to native code.|
||Interop||Optional Attribute. Controls policy for marshaling structures to native code.|
|policy_setting||The setting for this policy to apply to the types in the app. Possible values are
|<Assembly>||Applies policy to all the types in a particular assembly.|
|<Namespace>||Applies policy to all the types in a particular namespace.|
|<Type>||Applies policy to a particular type, such as a class or structure.|
|<TypeInstantiation>||Applies policy to a constructed generic type. For example, a <TypeInstantiation> element could be used to define policy for a
|<Method>||Applies policy to a method on a particular type.|
|<MethodInstantiation>||Applies policy to a constructed generic method.|
|<Property>||Applies policy to a property on a particular type.|
|<Field>||Applies policy to a field on a particular type.|
|<Event>||Applies policy to an event on a particular type.|
|<Directives>||The root element of a runtime directives file.|
The <Directives> element can contain zero or one
<Application> element. Multiple
<Application> elements in a single reflection directives file are not supported.
<Application> element can be used in one of two ways:
As a container to define the program elements whose metadata is needed at run time. In this case, the
<Application>element need not have any attributes. At compile time, compiler tools search all libraries, including .NET Framework core libraries, for program elements identified by child elements of the
<Application>element. In contrast, compiler tools search only the library designated by the <Library> element for program elements identified by the child elements of <Library>.
As an element that sets application-wide policy for reflection, serialization, and interop. The attributes of the
<Application>element define application-wide policy, which may be overridden by the child elements defined by the
<Application>or <Library> element.