diff --git a/xml/System.Reflection.Emit/AssemblyBuilder.xml b/xml/System.Reflection.Emit/AssemblyBuilder.xml index 1da51f68ab2..2cd9b40b713 100644 --- a/xml/System.Reflection.Emit/AssemblyBuilder.xml +++ b/xml/System.Reflection.Emit/AssemblyBuilder.xml @@ -442,7 +442,7 @@ The following code example shows how to define and use a dynamic assembly. The e The access rights of the assembly. Defines a dynamic assembly that has the specified name and access rights. An object that represents the new assembly. - To be added. + .NET 6+ only: If the property is null, then the assembly is created in the of the function that calls DefineDynamicAssembly. Otherwise, it's created with the specified in . @@ -505,9 +505,9 @@ The following code example shows how to define and use a dynamic assembly. The e The name of the assembly. The access rights of the assembly. A collection that contains the attributes of the assembly. - Defines a new assembly that has the specified name, access rights, and attributes. + Defines a dynamic assembly that has the specified name, access rights, and attributes. An object that represents the new assembly. - To be added. + .NET 6+ only: If the property is null, then the assembly is created in the of the function that calls DefineDynamicAssembly. Otherwise, it's created with the specified in . diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 25e7071cfd7..3c7efbac93b 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3241,6 +3241,8 @@ Note: In .NET for Win ## Remarks This method only searches the current assembly instance. The `name` parameter includes the namespace but not the assembly. To search other assemblies for a type, use the method overload, which can optionally include an assembly display name as part of the type name. + In .NET Core/.NET 5+, if there are assembly-qualified generic type parameters in the type name string, those assembly references will be loaded by the of the method that called Assembly.GetType, or by the context if it's set. + > [!NOTE] > If the type has been forwarded to another assembly, it is still returned by this method. For information on type forwarding, see [Type Forwarding in the Common Language Runtime](/dotnet/standard/assembly/type-forwarding). @@ -3345,6 +3347,8 @@ Note: In .NET for Win ## Remarks This method only searches the current assembly instance. The `name` parameter includes the namespace but not the assembly. To search other assemblies for a type, use the method overload, which can optionally include an assembly display name as part of the type name. + In .NET Core/.NET 5+, if there are assembly-qualified generic type parameters in the type name string, those assembly references will be loaded by the of the method that called Assembly.GetType, or by the context if it's set. + > [!NOTE] > If the type has been forwarded to another assembly, it is still returned by this method. For information on type forwarding, see [Type Forwarding in the Common Language Runtime](/dotnet/standard/assembly/type-forwarding). @@ -3450,6 +3454,8 @@ Note: In .NET for Win ## Remarks This method only searches the current assembly instance. The `name` parameter includes the namespace but not the assembly. To search other assemblies for a type, use the method overload, which can optionally include an assembly display name as part of the type name. + In .NET Core/.NET 5+, if there are assembly-qualified generic type parameters in the type name string, those assembly references will be loaded by the of the method that called Assembly.GetType, or by the context if it's set. + > [!NOTE] > If the type has been forwarded to another assembly, it is still returned by this method. For information on type forwarding, see [Type Forwarding in the Common Language Runtime](/dotnet/standard/assembly/type-forwarding). @@ -4097,7 +4103,7 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim ## Remarks -In .NET Core/.NET 5+, the target assembly will be loaded into the current . For more information on assembly loading, see [Managed assembly loading algorithm](/dotnet/core/dependency-loading/loading-managed#algorithm"). + In .NET Core/.NET 5+, the target assembly will be loaded into the current or into the context if it's set. For more information on assembly loading, see [Managed assembly loading algorithm](/dotnet/core/dependency-loading/loading-managed#algorithm). > [!NOTE] > **.NET Framework only:** For information about loading assemblies from remote locations, see [``](/dotnet/framework/configure-apps/file-schema/runtime/loadfromremotesources-element). @@ -4191,7 +4197,7 @@ Note: In .NET for Win ## Remarks -In .NET Core/5+, the target assembly is loaded into the current . For more information on assembly loading, see [Managed assembly loading algorithm](/dotnet/core/dependency-loading/loading-managed#algorithm"). + In .NET Core/.NET 5+, the target assembly will be loaded into the current or into the context if it's set. For more information on assembly loading, see [Managed assembly loading algorithm](/dotnet/core/dependency-loading/loading-managed#algorithm). To load the correct assembly, it's recommended to call the `Load` method by passing the long form of the assembly name. The long form of an assembly name consists of its simple name (such as "System" for the System.dll assembly) along with its version, culture, public key token, and optionally its processor architecture. It corresponds to the assembly's property. The following example illustrates the use of a long name to load the System.dll assembly for .NET Framework 4: @@ -5571,6 +5577,8 @@ The assembly is loaded into the default AssemblyLoadContext. For more informatio Applications that load assemblies with this method will be affected by upgrades of those assemblies. Therefore, do not use this method; redesign the application to use the method overload or the method overload. + In .NET Core/5+, the target assembly is loaded into the current or the if it's set. + This method first calls . If the assembly is not found, this method returns the assembly from the global assembly cache that has the same simple name, and the highest version number. ]]> diff --git a/xml/System/Activator.xml b/xml/System/Activator.xml index 21ac5a3d008..7f714692cce 100644 --- a/xml/System/Activator.xml +++ b/xml/System/Activator.xml @@ -574,6 +574,8 @@ Note: In .NET for Win For more information on how the common language runtime identifies and loads assemblies, see [How the Runtime Locates Assemblies](/dotnet/framework/deployment/how-the-runtime-locates-assemblies). For information on using the application configuration file to define assembly locations, see [Specifying an Assembly's Location](/dotnet/framework/configure-apps/specify-assembly-location). If `assemblyName` is found, it is loaded in the default context. + In .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . + > [!NOTE] > This method can be used to create nonpublic types if the caller has been granted with the flag and if the grant set of the assembly that contains the nonpublic types is restricted to the caller's grant set or to a subset thereof. (See [Security Considerations for Reflection](/dotnet/framework/reflection-and-codedom/security-considerations-for-reflection).) To use this functionality, your application should target .NET Framework 3.5 or later. @@ -1018,6 +1020,8 @@ Note: In .NET for Win ## Remarks Use to unwrap the return value. + In .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . + > [!NOTE] > This method can be used to create nonpublic types if the caller has been granted with the flag and if the grant set of the nonpublic types is restricted to the caller's grant set or to a subset thereof. (See [Security Considerations for Reflection](/dotnet/framework/reflection-and-codedom/security-considerations-for-reflection).) To use this functionality, your application should target .NET Framework 3.5 or later. @@ -1493,6 +1497,8 @@ An error occurred when attempting remote activation in a target specified in to unwrap the return value. + In .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . + > [!NOTE] > This method can be used to create nonpublic types and members if the caller has been granted with the flag and if the grant set of the assembly that contains the nonpublic types and members is restricted to the caller's grant set or to a subset thereof. (See [Security Considerations for Reflection](/dotnet/framework/reflection-and-codedom/security-considerations-for-reflection).) To use this functionality, your application should target .NET Framework 3.5 or later. diff --git a/xml/System/Type.xml b/xml/System/Type.xml index 15373d20539..e09aa681d65 100644 --- a/xml/System/Type.xml +++ b/xml/System/Type.xml @@ -9036,9 +9036,11 @@ You can use the method to obtain a [!NOTE] > If `typeName` cannot be found, the call to the method returns `null`. It does not throw an exception. To control whether an exception is thrown, call an overload of the method that has a `throwOnError` parameter. - only works on assemblies loaded from disk. If you call to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + .NET Framework only: only works on assemblies loaded from disk. If you call to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + + In .NET Framework, to use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. - To use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. + On .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . The following table shows what members of a base class are returned by the `Get` methods when reflecting on a type. @@ -9244,9 +9246,11 @@ Note: In .NET for Win ## Remarks You can use the method to obtain a object for a type in another assembly if you know its assembly-qualified name, which can be obtained from . causes loading of the assembly specified in `typeName`. You can also load an assembly using the method, and then use the or method to get objects. If a type is in an assembly known to your program at compile time, it's more efficient to use `typeof` in C# or the `GetType` operator in Visual Basic. - `GetType` only works on assemblies loaded from disk. If you call `GetType` to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + .NET Framework only: only works on assemblies loaded from disk. If you call to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + + In .NET Framework, to use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. - To use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. + On .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . The `throwOnError` parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of `throwOnError`. For example, if the type is found but cannot be loaded, a is thrown even if `throwOnError` is `false`. @@ -9479,9 +9483,11 @@ Note: In .NET for Win ## Remarks You can use the method to obtain a object for a type in another assembly if you know its assembly-qualified name, which can be obtained from . causes loading of the assembly specified in `typeName`. You can also load an assembly using the method, and then use the or method to get objects. If a type is in an assembly known to your program at compile time, it's more efficient to use `typeof` in C# or the `GetType` operator in Visual Basic. - `GetType` only works on assemblies loaded from disk. If you call `GetType` to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + .NET Framework only: only works on assemblies loaded from disk. If you call to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the `RunAndSave` or `Save` access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before `GetType` is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when `GetType` is called, the method returns `null`. `GetType` does not understand transient dynamic assemblies; therefore, calling `GetType` to retrieve a type in a transient dynamic assembly returns `null`. + + In .NET Framework, to use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. - To use `GetType` on a dynamic module, subscribe to the event and call `GetType` before saving. Otherwise, you will get two copies of the assembly in memory. + On .NET Core 3.0 and later versions, assembly loads triggered by this API are affected by the current value of . The `throwOnError` parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of `throwOnError`. For example, if the type is found but cannot be loaded, a is thrown even if `throwOnError` is `false`. @@ -9974,7 +9980,15 @@ Calling this method overload is the same as calling the to perform a case-insensitive search for , to perform a case-sensitive search for . Gets the type with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception if the type is not found, and optionally providing custom methods to resolve the assembly and the type. The type with the specified name. If the type is not found, the parameter specifies whether is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section. - For more information about this API, see Supplemental API remarks for Type.GetType. + + . + + For more information about this API, see [Supplemental API remarks for Type.GetType](/dotnet/fundamentals/runtime-libraries/system-type-gettype). + ]]> + is . A class initializer is invoked and throws an exception.