From 0713e02283972fabb45f91f634418df4123da2e4 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 17:51:15 -0800 Subject: [PATCH 01/10] Delete .NET Framework 1.0 note No longer relevant --- xml/System.Reflection/Assembly.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index b9c1e184525..7851008e01e 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -4075,9 +4075,6 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim - When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - > [!NOTE] - > In the .NET Framework version 1.0 and in version 1.1 without SP1, when you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is combined. `Zone`, `Url` and `Site` are inherited from the calling assembly, and `Hash` and `StrongName` are taken from the COFF assembly. - - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. @@ -4184,9 +4181,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - > [!NOTE] - > In the .NET Framework version 1.0 and in version 1.1 without SP1, when you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is combined. `Zone`, `Url` and `Site` are inherited from the calling assembly, and `Hash` and `StrongName` are taken from the COFF assembly. - - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. @@ -4370,9 +4364,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - > [!NOTE] - > In the .NET Framework version 1.0 and in version 1.1 without SP1, when you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is combined. `Zone`, `Url` and `Site` are inherited from the calling assembly, and `Hash` and `StrongName` are taken from the COFF assembly. - - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. @@ -4462,9 +4453,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - > [!NOTE] - > In the .NET Framework version 1.0 and in version 1.1 without SP1, when you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is combined. `Zone`, `Url` and `Site` are inherited from the calling assembly, and `Hash` and `StrongName` are taken from the COFF assembly. - - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. @@ -4555,9 +4543,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - > [!NOTE] - > In the .NET Framework version 1.0 and in version 1.1 without SP1, when you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is combined. `Zone`, `Url` and `Site` are inherited from the calling assembly, and `Hash` and `StrongName` are taken from the COFF assembly. - - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image are ignored. Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. From 2fd1f2b216be0f7ebd858b51109286af1dc60ad1 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 18:48:22 -0800 Subject: [PATCH 02/10] Generalize description for BadImageFormatException Delete explicit CLR 2.0 references --- xml/System.Reflection/Assembly.xml | 117 ++++++------------ xml/System/AppDomain.xml | 185 ++++++++--------------------- xml/System/Type.xml | 19 +-- 3 files changed, 88 insertions(+), 233 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 7851008e01e..d5ff4209fad 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3998,11 +3998,8 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + @@ -4105,9 +4102,8 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. - is not a valid assembly. -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + How the Runtime Locates Assemblies @@ -4206,11 +4202,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is not found. A file that was found could not be loaded. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + How the Runtime Locates Assemblies @@ -4295,11 +4288,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + @@ -4380,11 +4370,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. -or- @@ -4468,11 +4455,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + A file that was found could not be loaded. -or- @@ -4556,11 +4540,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. is not . By default, legacy CAS policy is not enabled in the .NET Framework 4; when it is not enabled, must be . @@ -4709,11 +4690,8 @@ Starting with .NET Framework 4, if `path` specifies an assembly in a remote loca The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. The parameter is an empty string ("") or does not exist. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + @@ -4780,11 +4758,8 @@ Starting with .NET Framework 4, if `path` specifies an assembly in a remote loca The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + is not . By default, legacy CAS policy is not enabled in the .NET Framework 4; when it is not enabled, must be . @@ -4930,11 +4905,8 @@ Starting with .NET Framework 4, the ability to execute code in assemblies loaded The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). The assembly name exceeds the system-defined maximum length. @@ -5052,11 +5024,8 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). The assembly name exceeds the system-defined maximum length. @@ -5304,11 +5273,8 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). The assembly name exceeds the system-defined maximum length. @@ -5583,11 +5549,8 @@ The ability to execute code in remote assemblies is disabled. See The parameter is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + @@ -5656,11 +5619,8 @@ The ability to execute code in remote assemblies is disabled. See An assembly or module was loaded twice with two different sets of evidence. The parameter is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + @@ -6198,11 +6158,8 @@ In .NET 5 and later versions, for bundled assemblies, the value returned is an e is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + cannot be loaded. .NET Core and .NET 5+ only: In all cases. @@ -6291,11 +6248,8 @@ In .NET 5 and later versions, for bundled assemblies, the value returned is an e is found, but cannot be loaded. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + .NET Core and .NET 5+ only: In all cases. @@ -6379,11 +6333,8 @@ In .NET 5 and later versions, for bundled assemblies, the value returned is an e is found, but could not be loaded. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + A codebase that does not start with "file://" was specified without the required . The assembly name exceeds the system-defined maximum length. diff --git a/xml/System/AppDomain.xml b/xml/System/AppDomain.xml index f85ad4a85c7..31653c4f341 100644 --- a/xml/System/AppDomain.xml +++ b/xml/System/AppDomain.xml @@ -1532,11 +1532,8 @@ This method overload uses the information from the or is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. was not found. @@ -1635,11 +1632,8 @@ This method overload uses the information from the or is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. was not found. @@ -1845,11 +1839,8 @@ This method overload uses the information from the or is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. was not found. @@ -1966,11 +1957,8 @@ This method overload uses the information from the The caller does not have permission to call this constructor. The operation is attempted on an unloaded application domain. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -2072,11 +2060,8 @@ This method overload uses the information from the The caller cannot provide activation attributes for an object that does not inherit from . The operation is attempted on an unloaded application domain. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -2303,11 +2288,8 @@ This method overload uses the information from the The caller cannot provide activation attributes for an object that does not inherit from . The operation is attempted on an unloaded application domain. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -2437,11 +2419,8 @@ This method overload uses the information from the No parameterless public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. This instance is . @@ -2545,11 +2524,8 @@ This method overload uses the information from the The caller cannot provide activation attributes for an object that does not inherit from . The operation is attempted on an unloaded application domain. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. This instance is . @@ -2775,11 +2751,8 @@ This method overload uses the information from the No matching public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. This instance is . @@ -2879,11 +2852,8 @@ This method overload uses the information from the No parameterless public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -2984,11 +2954,8 @@ This method overload uses the information from the No parameterless public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -3197,11 +3164,8 @@ This method overload uses the information from the No matching public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -4814,11 +4778,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. The specified assembly has no entry point. @@ -4899,11 +4860,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. The specified assembly has no entry point. @@ -5085,11 +5043,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -5289,11 +5244,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -5377,11 +5329,7 @@ This method overload uses the information from the is . The assembly specified by is not found. - The assembly specified by is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + The assembly specified by is not a valid assembly for the currently loaded runtime. The operation is attempted on an unloaded application domain. The assembly specified by was found, but could not be loaded. The specified assembly has no entry point. @@ -5537,11 +5485,7 @@ This method overload uses the information from the is . The assembly specified by is not found. The assembly specified by was found, but could not be loaded. - The assembly specified by is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + The assembly specified by is not a valid assembly for the currently loaded runtime.. The operation is attempted on an unloaded application domain. The specified assembly has no entry point. @@ -5704,11 +5648,7 @@ This method overload uses the information from the The assembly specified by is not found. The assembly specified by was found, but could not be loaded. - The assembly specified by is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + The assembly specified by is not a valid assembly for the currently loaded runtime. The operation is attempted on an unloaded application domain. is not . When legacy CAS policy is not enabled, should be . @@ -5788,11 +5728,7 @@ This method overload uses the information from the is . The assembly specified by is not found. The assembly specified by was found, but could not be loaded. - The assembly specified by is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + The assembly specified by is not a valid assembly for the currently loaded runtime. The operation is attempted on an unloaded application domain. is not . When legacy CAS policy is not enabled, should be . @@ -6771,11 +6707,8 @@ This method overload uses the information from the is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -6865,11 +6798,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -6945,11 +6875,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -7051,11 +6978,8 @@ This method overload uses the information from the is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -7123,11 +7047,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -7195,11 +7116,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. @@ -7281,11 +7199,8 @@ This method overload uses the information from the is . - is not a valid assembly. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded and was compiled with a later version. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. diff --git a/xml/System/Type.xml b/xml/System/Type.xml index c2f017a9861..de308aaa654 100644 --- a/xml/System/Type.xml +++ b/xml/System/Type.xml @@ -9074,11 +9074,8 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. - The assembly or one of its dependencies is not valid. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded, and the assembly was compiled with a later version. + The assembly is not valid for the currently loaded runtime. + @@ -9312,11 +9309,7 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. - The assembly or one of its dependencies is not valid. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded, and the assembly was compiled with a later version. + The assembly or one of its dependencies is not valid for the currently loaded runtime. @@ -9537,11 +9530,7 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs is and the assembly or one of its dependencies was not found. The assembly or one of its dependencies was found, but could not be loaded. - The assembly or one of its dependencies is not valid. - - -or- - - Version 2.0 or later of the common language runtime is currently loaded, and the assembly was compiled with a later version. + The assembly is not valid for the currently loaded runtime. From 489c693a5e83e8d8ebb55181cd0d71b550a64abc Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 18:53:43 -0800 Subject: [PATCH 03/10] Delete note about reflecting on C++ files This problem become irrelevant with introduction of ASLR in Windows Vista (2008) --- xml/System.Reflection/Assembly.xml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index d5ff4209fad..7b7afbb9444 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3989,8 +3989,6 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim ## Remarks The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - Note that this method overload always creates a new object with its own mapping. ]]> @@ -4074,8 +4072,6 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - > [!NOTE] > If both the property and the property are set, the first attempt to load the assembly uses the display name (including version, culture, and so on, as returned by the property). If the file is not found, is used to search for the assembly. If the assembly is found using , the display name is matched against the assembly. If the match fails, a is thrown. @@ -4179,8 +4175,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, the recommended way to specify an assembly name is to create an object and pass it to an appropriate overload of the method. See . @@ -4279,8 +4273,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass ## Remarks The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - Note that this method overload always creates a new object with its own mapping. ]]> @@ -4356,8 +4348,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - > [!NOTE] > If both the property and the property are set, the first attempt to load the assembly uses the display name (including version, culture, and so on, as returned by the property). If the file is not found, is used to search for the assembly. If the assembly is found using , the display name is matched against the assembly. If the match fails, a is thrown. @@ -4442,8 +4432,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - If you call this method more than once on the same assembly but with a different evidence specified, the common language runtime does not throw a because the equality and integrity of the different evidence specifications cannot be determined. The evidence that first succeeds is the evidence that is used. In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, the recommended way to specify an assembly name is to create an object and pass it to an appropriate overload of the method. See . @@ -4529,8 +4517,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image are ignored. - Reflecting on C++ executable files might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the `.reloc` section from your executable file. To preserve the `.reloc` address for your C++ executable file, specify `/fixed:no` when you are linking. - If you call the method more than once on the same assembly but with a different evidence specified, the common language runtime does not throw a because the equality and integrity of the different evidence specifications cannot be determined. The evidence that first succeeds is the evidence that is used. Note that this method overload always creates a new object with its own mapping. From d29dc72a71c3d3ab04456f4dbbed00315dce22b2 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 19:03:51 -0800 Subject: [PATCH 04/10] Move .NET Framework-specific content to be last --- xml/System.Reflection/Assembly.xml | 9 ++++++--- xml/System/AppDomain.xml | 24 +++--------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 7b7afbb9444..ba052f5a3c1 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3984,13 +3984,15 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller. The loaded assembly. - + method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. Note that this method overload always creates a new object with its own mapping. + **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. + ]]> @@ -4271,10 +4273,11 @@ To load the correct assembly, it's recommended to call the `Load` method by pass method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. Note that this method overload always creates a new object with its own mapping. + **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. + ]]> diff --git a/xml/System/AppDomain.xml b/xml/System/AppDomain.xml index 31653c4f341..5ef8f406590 100644 --- a/xml/System/AppDomain.xml +++ b/xml/System/AppDomain.xml @@ -6684,13 +6684,9 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. - + Beginning with the .NET Framework 4, the trust level of an assembly that is loaded by using this method is the same as the trust level of the application domain. ## Examples The following sample demonstrates the use of loading a raw assembly. @@ -6864,8 +6860,6 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. ]]> @@ -6955,13 +6949,9 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. - + Beginning with the .NET Framework 4, the trust level of an assembly that is loaded by using this method is the same as the trust level of the application domain. ## Examples The following sample demonstrates the use of loading a raw assembly. @@ -7036,8 +7026,6 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. ]]> @@ -7105,8 +7093,6 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. ]]> @@ -7176,13 +7162,9 @@ This method overload uses the information from the method. To load assemblies into other application domains, use a method such as . - For information that is common to all overloads of this method, see the method overload. - + Beginning with the .NET Framework 4, the trust level of an assembly that is loaded by using this method is the same as the trust level of the application domain. ## Examples The following sample demonstrates the use of loading a raw assembly. From f5750c9e66e60cbadb79a889154c1fb294134d32 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 19:07:46 -0800 Subject: [PATCH 05/10] Delete "The assembly is loaded into the application domain of the caller." --- xml/System.Reflection/Assembly.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index ba052f5a3c1..17f37e9c0eb 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3981,7 +3981,7 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim A byte array that is a COFF-based image containing an emitted assembly. - Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller. + Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The loaded assembly. @@ -4267,7 +4267,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass A byte array that is a COFF-based image containing an emitted assembly. A byte array that contains the raw bytes representing the symbols for the assembly. - Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The assembly is loaded into the application domain of the caller. + Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The loaded assembly. A byte array that is a COFF-based image containing an emitted assembly. A byte array that contains the raw bytes representing the symbols for the assembly. Evidence for loading the assembly. - Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and evidence for the assembly. The assembly is loaded into the application domain of the caller. + Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and evidence for the assembly. The loaded assembly. A byte array that is a COFF-based image containing an emitted assembly. A byte array that contains the raw bytes representing the symbols for the assembly. The source of the security context. - Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and specifying the source for the security context. The assembly is loaded into the application domain of the caller. + Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and specifying the source for the security context. The loaded assembly. Date: Tue, 5 Mar 2024 19:14:36 -0800 Subject: [PATCH 06/10] More BadImageFormatException cleanup --- xml/System.Reflection/Assembly.xml | 21 ++++--------- xml/System/AppDomain.xml | 47 ++++++++---------------------- xml/System/Type.xml | 24 +++------------ 3 files changed, 22 insertions(+), 70 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 17f37e9c0eb..a5e05fd3692 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -4588,11 +4588,8 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is . - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + The value of is not one of the enumeration values. @@ -5136,11 +5133,8 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). The assembly name exceeds the system-defined maximum length. @@ -6657,11 +6651,8 @@ In .NET 5 and later versions, for bundled assemblies, the value returned is an e is not found, or the module you are trying to load does not specify a filename extension. A file that was found could not be loaded. - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). The assembly name exceeds the system-defined maximum length. diff --git a/xml/System/AppDomain.xml b/xml/System/AppDomain.xml index 5ef8f406590..5a0749abecd 100644 --- a/xml/System/AppDomain.xml +++ b/xml/System/AppDomain.xml @@ -1744,11 +1744,8 @@ This method overload uses the information from the or is . - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. was not found. @@ -2184,11 +2181,8 @@ This method overload uses the information from the The caller cannot provide activation attributes for an object that does not inherit from . The operation is attempted on an unloaded application domain. - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. @@ -2644,11 +2638,8 @@ This method overload uses the information from the No matching public constructor was found. The caller does not have sufficient permission to call this constructor. - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + An assembly or module was loaded twice with two different evidences. This instance is . @@ -4956,11 +4947,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. The specified assembly has no entry point. @@ -5156,11 +5144,8 @@ This method overload uses the information from the is not found. - is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + is not a valid assembly for the currently loaded runtime. + The operation is attempted on an unloaded application domain. An assembly or module was loaded twice with two different evidences. The specified assembly has no entry point. @@ -5413,11 +5398,7 @@ This method overload uses the information from the The assembly specified by is not found. The assembly specified by was found, but could not be loaded. - The assembly specified by is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly specified by is not a valid assembly for the currently loaded runtime. The operation is attempted on an unloaded application domain. The specified assembly has no entry point. @@ -5569,11 +5550,7 @@ This method overload uses the information from the is . The assembly specified by is not found. The assembly specified by was found, but could not be loaded. - The assembly specified by is not a valid assembly. - - -or- - - was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly specified by is not a valid assembly for the currently loaded runtime. The operation is attempted on an unloaded application domain. The specified assembly has no entry point. diff --git a/xml/System/Type.xml b/xml/System/Type.xml index de308aaa654..f6d15f27788 100644 --- a/xml/System/Type.xml +++ b/xml/System/Type.xml @@ -9648,11 +9648,7 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs -or- is a valid assembly name without a type name. - The assembly or one of its dependencies is not valid. - - -or- - - The assembly was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly or one of its dependencies is not valid for the currently loaded runtime. @@ -9785,11 +9781,7 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs is a valid assembly name without a type name. The assembly or one of its dependencies was found, but could not be loaded. - The assembly or one of its dependencies is not valid. - - -or- - - The assembly was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly or one of its dependencies is not valid for the currently loaded runtime. @@ -9916,11 +9908,7 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs -or- is a valid assembly name without a type name. - The assembly or one of its dependencies is not valid. - - -or- - - The assembly was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly or one of its dependencies is not a valid assembly for the currently loaded runtime. @@ -16972,11 +16960,7 @@ The following example uses the method to c is and the assembly or one of its dependencies was not found. The assembly or one of its dependencies was found, but could not be loaded. - The assembly or one of its dependencies is not valid. - - -or- - - The assembly was compiled with a later version of the common language runtime than the version that is currently loaded. + The assembly or one of its dependencies is not a valid assembly for the currently loaded runtime. .NET Core and .NET 5+ only: In all cases. From 61dd17f90e2a2962dbed667ac30bc181df355fc6 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Mar 2024 19:25:30 -0800 Subject: [PATCH 07/10] Delete more instance of "loaded into domain of the caller" --- xml/System.Reflection/Assembly.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index a5e05fd3692..77600a66ef7 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -4330,7 +4330,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass The object that describes the assembly to be loaded. Evidence for loading the assembly. - Loads an assembly given its . The assembly is loaded into the domain of the caller using the supplied evidence. + Loads an assembly given its . The assembly is loaded using the supplied evidence. The loaded assembly. The display name of the assembly. Evidence for loading the assembly. - Loads an assembly given its display name, loading the assembly into the domain of the caller using the supplied evidence. + Loads an assembly given its display name, loading the assembly using the supplied evidence. The loaded assembly. The fully qualified path of the assembly file. Evidence for loading the assembly. - Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence. + Loads an assembly given its path, loading the assembly using the supplied evidence. The loaded assembly. [!NOTE] > File transfer protocol (FTP) is not supported. If the URI supplied for `assemblyFile` is an FTP address, the assembly is not loaded. No exception is thrown. - `assemblyFile` may be absolute or relative to the current directory, and the assembly is loaded into the domain of the caller. + `assemblyFile` may be absolute or relative to the current directory. Assemblies can be loaded into one of three contexts, or can be loaded without context: @@ -4952,7 +4952,7 @@ The ability to execute code in remote assemblies is disabled. See [!NOTE] > File transfer protocol (FTP) is not supported. If the URI supplied for `assemblyFile` is an FTP address, the assembly is not loaded. No exception is thrown. - `assemblyFile` may be absolute or relative to the current directory, and the assembly is loaded into the domain of the caller. + `assemblyFile` may be absolute or relative to the current directory. Assemblies can be loaded into one of three contexts, or can be loaded without context: @@ -5198,7 +5198,7 @@ The ability to execute code in remote assemblies is disabled. See The display name of the assembly. Evidence for loading the assembly. - Loads an assembly from the application directory or from the global assembly cache using a partial name. The assembly is loaded into the domain of the caller using the supplied evidence. + Loads an assembly from the application directory or from the global assembly cache using a partial name. The assembly is loaded using the supplied evidence. The loaded assembly. If is not found, this method returns . Date: Tue, 5 Mar 2024 19:31:24 -0800 Subject: [PATCH 08/10] Note that Assembly.Load creates assembly in isolated load context --- xml/System.Reflection/Assembly.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 77600a66ef7..7cb174aac8f 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -3989,7 +3989,7 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim ## Remarks - Note that this method overload always creates a new object with its own mapping. + This method overload always creates a new object in its own isolated assembly load context. **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. @@ -4274,7 +4274,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass ## Remarks - Note that this method overload always creates a new object with its own mapping. + This method overload always creates a new object in its own isolated assembly load context. **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. @@ -4508,7 +4508,10 @@ To load the correct assembly, it's recommended to call the `Load` method by pass object in its own isolated assembly load context. + +The assembly is loaded using the supplied evidence. The raw bytes representing the symbols for the assembly are also loaded. Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows: @@ -4522,8 +4525,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass If you call the method more than once on the same assembly but with a different evidence specified, the common language runtime does not throw a because the equality and integrity of the different evidence specifications cannot be determined. The evidence that first succeeds is the evidence that is used. - Note that this method overload always creates a new object with its own mapping. - ]]> From e393abf07d35359dfdc625796aff63fc264959ac Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 7 Mar 2024 15:24:43 -0800 Subject: [PATCH 09/10] FB --- xml/System.Reflection/Assembly.xml | 93 +++++++----------------------- 1 file changed, 22 insertions(+), 71 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index 7cb174aac8f..e8ea356eb54 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -405,11 +405,8 @@ In .NET 5 and later versions, for bundled assemblies, this property throws an ex The current assembly was loaded into the reflection-only context, and requires a dependent assembly that was not preloaded. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly that was compiled for a version of the runtime that is later than the currently loaded version. + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + @@ -511,11 +508,8 @@ In .NET 5 and later versions, for bundled assemblies, this property throws an ex The current assembly was loaded into the reflection-only context, and requires a dependent assembly that was not preloaded. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly that was compiled for a version of the runtime that is later than the currently loaded version. + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + @@ -632,12 +626,9 @@ In .NET 5 and later versions, for bundled assemblies, this property throws an ex The current assembly was loaded into the reflection-only context, and requires a dependent assembly that was not preloaded. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly which that was compiled for a version of the runtime that is later than the currently loaded version. - + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + + @@ -3239,12 +3230,9 @@ Note: In .NET for Win Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version. - + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + + @@ -3340,12 +3328,9 @@ Note: In .NET for Win The current assembly was loaded into the reflection-only context, and requires a dependent assembly that was not preloaded. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version. - + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + + @@ -3447,12 +3432,9 @@ Note: In .NET for Win The current assembly was loaded into the reflection-only context, and requires a dependent assembly that was not preloaded. - requires a dependent assembly, but the file is not a valid assembly. - - -or- - - requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version. - + requires a dependent assembly, but the file is not a valid assembly for the currently loaded runtime. + + @@ -3989,7 +3971,7 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim ## Remarks - This method overload always creates a new object in its own isolated assembly load context. + This method overload always creates a new object in its own isolated load context. **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. @@ -4064,16 +4046,6 @@ This property is marked obsolete starting in .NET 5, and generates a compile-tim > [!NOTE] > Do not use an with only the property set. The property does not supply any elements of the assembly identity (such as name or version), so loading does not occur according to load-by-identity rules, as you would expect from the method. Instead, the assembly is loaded using load-from rules. For information about the disadvantages of using the load-from context, see the method overload or [Best Practices for Assembly Loading](/dotnet/framework/deployment/best-practices-for-assembly-loading). - Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows: - -- When you use a method with no parameter, the assembly is loaded with the evidence that the loader supplies. - -- When you use a method with an parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the method supersede pieces of evidence supplied by the loader. - -- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - -- When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - > [!NOTE] > If both the property and the property are set, the first attempt to load the assembly uses the display name (including version, culture, and so on, as returned by the property). If the file is not found, is used to search for the assembly. If the assembly is found using , the display name is matched against the assembly. If the match fails, a is thrown. @@ -4167,16 +4139,6 @@ To load the correct assembly, it's recommended to call the `Load` method by pass is thrown if `assemblyString` specifies the full assembly name, and the first assembly that matches the simple name has a different version, culture, or public key token. The loader does not continue probing for other assemblies that match the simple name. - Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows: - -- When you use a method with no parameter, the assembly is loaded with the evidence that the loader supplies. - -- When you use a method with an parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the method supersede pieces of evidence supplied by the loader. - -- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. - -- When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. - In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, the recommended way to specify an assembly name is to create an object and pass it to an appropriate overload of the method. See . @@ -4274,7 +4236,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass ## Remarks - This method overload always creates a new object in its own isolated assembly load context. + This method overload always creates a new object in its own isolated load context. **.NET Framework only:** The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the method overload. For more information about the use of evidence with overloads of the method that take byte arrays, see the method overload. @@ -4347,7 +4309,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with an parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the method supersede pieces of evidence supplied by the loader. -- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. +- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. @@ -4431,7 +4393,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass - When you use a method with an parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the method supersede pieces of evidence supplied by the loader. -- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. +- When you use a method overload with a `Byte[]` parameter to load a common object file format (COFF) image, evidence is inherited from the calling assembly. - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored. @@ -4509,7 +4471,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass ## Remarks -This method overload always creates a new object in its own isolated assembly load context. +This method overload always creates a new object in its own isolated load context. The assembly is loaded using the supplied evidence. The raw bytes representing the symbols for the assembly are also loaded. @@ -4519,7 +4481,7 @@ The assembly is loaded using the supplied evidence. The raw bytes representing t - When you use a method with an parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the method supersede pieces of evidence supplied by the loader. -- When you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is inherited from the calling assembly. This applies to the .NET Framework version 1.1 Service Pack 1 (SP1) and subsequent releases. +- When you use a method overload with a `Byte[]` parameter to load a COFF image, evidence is inherited from the calling assembly. - When you use a method with a `Byte[]` parameter and to load a COFF image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image are ignored. @@ -4869,8 +4831,6 @@ Starting with .NET Framework 4, the ability to execute code in assemblies loaded - If a native image exists for `assemblyFile`, it is not used. The assembly cannot be loaded as domain neutral. -- In the .NET Framework version 1.0 and 1.1, policy is not applied. - ## Examples @@ -4981,8 +4941,6 @@ The ability to execute code in remote assemblies is disabled. See method with no parameter, the assembly is loaded with the evidence that the loader supplies. @@ -6214,11 +6170,6 @@ In .NET 5 and later versions, for bundled assemblies, the value returned is an e You cannot execute code from an assembly loaded into the reflection-only context. To execute code, the assembly must be loaded into the execution context as well, using the method. - Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows: - -> [!NOTE] -> Reflecting on executable files compiled in C++ might throw a . This is most likely caused by the C++ compiler stripping the relocation addresses or the .reloc section from your executable file. To preserve the .reloc address, specify `/fixed:no` when you are linking. - The reflection-only context is no different from other contexts. Assemblies that are loaded into the context can be unloaded only by unloading the application domain. ]]> From c985729a2ba2f0c27115b54e4e529a04c90da1c7 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 13 Mar 2024 22:49:07 -0700 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- xml/System.Reflection/Assembly.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xml/System.Reflection/Assembly.xml b/xml/System.Reflection/Assembly.xml index e8ea356eb54..a38ffe376b1 100644 --- a/xml/System.Reflection/Assembly.xml +++ b/xml/System.Reflection/Assembly.xml @@ -4379,7 +4379,7 @@ To load the correct assembly, it's recommended to call the `Load` method by pass The display name of the assembly. Evidence for loading the assembly. - Loads an assembly given its display name, loading the assembly using the supplied evidence. + Loads an assembly given its display name and using the supplied evidence. The loaded assembly. <loadFromRemoteSources>. - is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). @@ -4913,7 +4913,7 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). @@ -5050,7 +5050,7 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. A codebase that does not start with "file://" was specified without the required . The parameter is an empty string (""). @@ -5157,7 +5157,7 @@ The ability to execute code in remote assemblies is disabled. See <loadFromRemoteSources>. - is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. + is not a valid assembly for the currently loaded runtime; for example, a 32-bit assembly in a 64-bit process. A codebase that does not start with "file://" was specified without the required . The parameter is an empty string ("").