You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -113,46 +107,18 @@ For more information and examples, see [How to: Inspect assembly contents using
113
107
114
108
The core assembly is treated differently than other assemblies because references to these well-known types do not include the assembly reference, unlike normal types.
115
109
116
-
Typically, this assembly is named "mscorlib" or "netstandard". If the core assembly cannot be found, the value will be `null`, and many other reflection methods, including those that parse method signatures, will throw an exception.
110
+
Typically, this assembly is named "System.Runtime", "mscorlib", or "netstandard".
117
111
118
-
The `CoreAssembly` is determined by passing the `coreAssemblyName` parameter passed to the <xref:System.Reflection.MetadataAssemblyResolver> constructor
119
-
to the <xref:System.Reflection.MetadataAssemblyResolver.Resolve*?displayProperty=nameWithType> method.
112
+
The `CoreAssembly` is determined by passing the `coreAssemblyName` parameter to the <xref:System.Reflection.MetadataLoadContext> constructor,
113
+
which in turn passes it to the <xref:System.Reflection.MetadataAssemblyResolver.Resolve*?displayProperty=nameWithType> method.
120
114
121
115
If no `coreAssemblyName` argument was specified in the constructor of <xref:System.Reflection.MetadataLoadContext>, then default values are used, including "mscorlib", "System.Runtime" and "netstandard".
122
116
123
117
The designated core assembly does not need to contain the core types directly. It can type forward them to other assemblies. Thus, it is perfectly permissible to use the mscorlib facade as the designated core assembly.
124
118
125
119
Note that <xref:System.Runtime> is not an ideal core assembly because it excludes some of the interop-related pseudo-custom attribute types such as <xref:System.Runtime.InteropServices.DllImportAttribute>. However, it can serve if you have no interest in those attributes. The CustomAttributes API will skip those attributes if the core assembly does not include the necessary types.
126
120
127
-
The core assembly is not loaded until necessary. The following APIs do not trigger the search for the core assembly:
If a core assembly cannot be found or if the core assembly is missing types, this will affect the behavior of the <xref:System.Reflection.MetadataLoadContext> as follows:
145
-
146
-
* APIs that need to parse signatures or typespecs and return the results as <xref:System.Type> objects will throw an exception. For example:
* APIs that need to compare types to well-known core types will not throw an exception, and the comparison will evaluate to `false`. For example, if you do not specify a core assembly, <xref:System.Type.IsPrimitive> will return `false` for everything, even types named <xref:System.Int32>. Similarly, <xref:System.Type.GetTypeCode*?displayProperty=nameWithType> will return <xref:System.TypeCode.Object> for everything.
154
-
155
-
* If a metadata entity sets flags that surface as a pseudo-custom attribute, and the core assembly does not contain the pseudo-custom attribute type, the necessary constructor or any of the parameter types of the constructor, the <xref:System.Reflection.MetadataLoadContext> will not throw. It will omit the pseudo-custom attribute from the list of returned attributes.
121
+
If a core assembly cannot be found, the constructor of <xref:System.Reflection.MetadataLoadContext> throws an exception.
0 commit comments