Reinstate supplemental remarks (System.R*)#12707
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reinstates “supplemental remarks” content by replacing external “Supplemental API remarks” links with in-repo markdown remarks in several ECMA XML files, and adds/updates snippet projects to support the expanded documentation (per #12613).
Changes:
- Replaced “Supplemental API remarks” link-only
<remarks>with full markdown remark content for severalSystem.ResourcesandSystem.Reflection.*APIs. - Added/updated snippet projects and source files (C# + Visual Basic) referenced from the reinstated remarks.
- Updated Reflection Emit docs to mention persisted dynamic assemblies and related concepts.
Reviewed changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| xml/System.Resources/SatelliteContractVersionAttribute.xml | Replaces supplemental-remarks link with inlined markdown remarks. |
| xml/System.Resources/ResourceReader.xml | Replaces supplemental-remarks link with inlined markdown remarks and snippet references. |
| xml/System.Resources/ResourceManager.xml | Replaces supplemental-remarks links with large inlined markdown remarks (type + member remarks). |
| xml/System.Resources/NeutralResourcesLanguageAttribute.xml | Replaces supplemental-remarks link with inlined markdown remarks and examples. |
| xml/System.Resources/MissingManifestResourceException.xml | Replaces supplemental-remarks link with inlined markdown remarks and snippet references. |
| xml/System.Reflection.PortableExecutable/DebugDirectoryEntryType.xml | Replaces supplemental-remarks link with inlined markdown remarks and spec links. |
| xml/System.Reflection.Emit/TypeBuilder.xml | Replaces supplemental-remarks link with inlined markdown remarks. |
| xml/System.Reflection.Emit/PersistedAssemblyBuilder.xml | Replaces link-only remarks with detailed persisted Reflection Emit guidance and snippet references. |
| xml/System.Reflection.Emit/MethodBuilder.xml | Replaces supplemental-remarks link with inlined markdown remarks. |
| xml/System.Reflection.Emit/DynamicMethod.xml | Replaces supplemental-remarks link with inlined markdown remarks. |
| xml/System.Reflection.Emit/AssemblyBuilder.xml | Replaces link-only remarks with updated runnable/persisted assembly content. |
| snippets/visualbasic/System.Resources/ResourceReader/Overview/Project.vbproj | Adds VB snippet project for ResourceReader overview snippets. |
| snippets/visualbasic/System.Resources/ResourceReader/Overview/ctor1.vb | Adds VB ctor snippets for standalone/embedded ResourceReader usage. |
| snippets/visualbasic/System.Resources/ResourceReader/Overview/class1.vb | Adds VB enumeration snippet for ResourceReader. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/showtime.vb | Adds VB example used by ResourceManager overview remarks. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/showdate.vb | Adds VB culture-switching example used by ResourceManager remarks. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/rmc.vb | Adds VB satellite-assembly example used by ResourceManager remarks. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/resourcenames.vb | Adds VB utility snippet for enumerating embedded resource names. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/Project.vbproj | Adds VB snippet project for ResourceManager overview examples. |
| snippets/visualbasic/System.Resources/ResourceManager/Overview/ctor1.vb | Adds VB constructor snippets for ResourceManager instantiation patterns. |
| snippets/visualbasic/System.Resources/ResourceManager/GetString/showdate2.vb | Adds VB GetString overload example snippet. |
| snippets/visualbasic/System.Resources/ResourceManager/GetString/showdate.vb | Adds VB GetString example snippet. |
| snippets/visualbasic/System.Resources/ResourceManager/GetString/Project.vbproj | Adds VB snippet project for ResourceManager.GetString examples. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/shownumbers.vb | Adds VB GetObject example snippet. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/Project.vbproj | Adds VB snippet project for ResourceManager.GetObject examples. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/numberinfo.vb | Adds VB serializable type snippet for GetObject example set. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/example2.vb | Adds VB console output example snippet for GetObject scenario. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/example.vb | Adds VB resource-creation + structure snippets referenced by GetObject remarks. |
| snippets/visualbasic/System.Resources/ResourceManager/GetObject/createresources.vb | Adds VB resource generation snippet for GetObject examples. |
| snippets/visualbasic/System.Resources/ResourceManager/.ctor/Project.vbproj | Adds VB snippet project for ResourceManager constructor docs. |
| snippets/visualbasic/System.Resources/ResourceManager/.ctor/greet.vb | Adds VB example snippet referenced by ctor remarks. |
| snippets/visualbasic/System.Resources/ResourceManager/.ctor/example.vb | Adds VB example snippet referenced by ctor remarks. |
| snippets/visualbasic/System.Resources/NeutralResourcesLanguageAttribute/Overview/Project.vbproj | Adds VB snippet project for NeutralResourcesLanguageAttribute examples. |
| snippets/visualbasic/System.Resources/NeutralResourcesLanguageAttribute/Overview/example.vb | Adds VB example snippet for NeutralResourcesLanguageAttribute. |
| snippets/visualbasic/System.Resources/MissingManifestResourceException/Overview/resourcenames.vb | Adds VB utility snippet for MissingManifestResourceException docs. |
| snippets/visualbasic/System.Resources/MissingManifestResourceException/Overview/Project.vbproj | Adds VB snippet project for MissingManifestResourceException examples. |
| snippets/visualbasic/System.Resources/CurrentCulture/Overview/Project.vbproj | Adds VB snippet project for culture example referenced from ResourceManager docs. |
| snippets/visualbasic/System.Resources/CurrentCulture/Overview/example.vb | Adds VB example snippet for culture switching. |
| snippets/csharp/System.Resources/ResourceManager/Overview/rmc.cs | Adds C# satellite-assembly example snippet referenced by remarks. |
| snippets/csharp/System.Resources/ResourceManager/Overview/Project.csproj | Adds C# snippet project for ResourceManager overview examples. |
| snippets/csharp/System.Resources/ResourceManager/Overview/example2.cs | Adds C# console table example snippet referenced by GetObject remarks. |
| snippets/csharp/System.Resources/ResourceManager/Overview/example11.cs | Adds C# resource generation snippet referenced by GetObject remarks. |
| snippets/csharp/System.Resources/ResourceManager/Overview/example1.cs | Adds C# serializable struct snippet referenced by GetObject remarks. |
| snippets/csharp/System.Resources/ResourceManager/Overview/example.cs | Adds C# culture-switching example snippet referenced by type remarks. |
| snippets/csharp/System.Resources/ResourceManager/Overview/ctor1.cs | Adds C# ctor snippets referenced by ResourceManager remarks. |
| snippets/csharp/System.Resources/ResourceManager/GetObject/shownumbers.cs | Adds C# GetObject example snippet. |
| snippets/csharp/System.Resources/ResourceManager/GetObject/Project.csproj | Adds C# snippet project for ResourceManager.GetObject examples. |
| snippets/csharp/System.Resources/ResourceManager/GetObject/numberinfo.cs | Adds C# serializable type snippet for GetObject examples. |
| snippets/csharp/System.Resources/ResourceManager/GetObject/createresources.cs | Adds C# resource generation snippet for GetObject examples. |
| snippets/csharp/System.Resources/ResourceManager/.ctor/Project.csproj | Adds C# snippet project for ResourceManager constructor docs. |
| snippets/csharp/System.Resources/ResourceManager/.ctor/greet.cs | Adds C# greeting example snippet referenced by ctor remarks. |
| snippets/csharp/System.Resources/ResourceManager/.ctor/example.cs | Adds C# “Hello World” ResourceManager example referenced by ctor remarks. |
| snippets/csharp/System.Resources/ResourceManager/.ctor/ctor1.cs | Adds C# ctor snippet referenced by ResourceManager ctor remarks. |
| snippets/csharp/System.Resources/NeutralResourcesLanguageAttribute/Overview/Project.csproj | Adds C# snippet project for NeutralResourcesLanguageAttribute examples. |
| snippets/csharp/System.Resources/NeutralResourcesLanguageAttribute/Overview/example.cs | Adds C# example snippet for NeutralResourcesLanguageAttribute. |
| snippets/csharp/System.Resources/MissingManifestResourceException/Overview/showtime.cs | Adds C# snippet referenced by ResourceManager remarks and exception docs. |
| snippets/csharp/System.Resources/MissingManifestResourceException/Overview/showdate2.cs | Adds C# snippet referenced by ResourceManager.GetString remarks. |
| snippets/csharp/System.Resources/MissingManifestResourceException/Overview/showdate1.cs | Adds C# snippet referenced by ResourceManager.GetString remarks. |
| snippets/csharp/System.Resources/MissingManifestResourceException/Overview/showdate.cs | Adds C# snippet referenced by MissingManifestResourceException/ResourceManager docs. |
| snippets/csharp/System.Resources/MissingManifestResourceException/Overview/Project.csproj | Adds C# snippet project for MissingManifestResourceException examples. |
| } | ||
| ``` | ||
|
|
||
| The <xref:System.Reflection.Emit.PersistedAssemblyBuilder> type, which derives from <xref:System.Reflection.Emit.AssemblyBuilder>, lets you save dynamic assemblies. For more information, see the usage scenarios and examples at <xref:System.Reflection.Emit.PersistedAssemblyBuilder>. |
There was a problem hiding this comment.
We didn't keep the warning here for AssemblyBuilder. Should it be included? Was the thinking that it was already mentioned for PersistedAssemblyBuilder so it did not need to be repeated, or has the behaviour of AssemblyBuilder changed and does not require the warning? Seems like we would still want to explicity call it out here, but I'm guessing really.
|
|
||
| - <xref:System.Reflection.Emit.AssemblyBuilderAccess.RunAndCollect?displayProperty=nameWithType> | ||
|
|
||
| The dynamic assembly represented by an <xref:System.Reflection.Emit.AssemblyBuilder> can be used to execute the emitted code and is automatically reclaimed by garbage collector. |
There was a problem hiding this comment.
| The dynamic assembly represented by an <xref:System.Reflection.Emit.AssemblyBuilder> can be used to execute the emitted code and is automatically reclaimed by garbage collector. | |
| The dynamic assembly represented by an <xref:System.Reflection.Emit.AssemblyBuilder> can be used to execute the emitted code and is automatically reclaimed by the garbage collector. |
Added missing "the".
|
|
||
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. | ||
|
|
||
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. |
There was a problem hiding this comment.
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. | |
| The example requires the text-based resource files listed in the following table. Each has a single string resource named `DateStart`. |
Added missing "the".
|
|
||
| ### Example | ||
|
|
||
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. |
There was a problem hiding this comment.
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. | |
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in the following table. Each has a single string resource named `DateStart`. |
Added missing "the".
|
|
||
| The following example uses the <xref:System.Resources.ResourceManager.GetString(System.String,System.Globalization.CultureInfo)> method to retrieve culture-specific resources. The example's default culture is English (en), and it includes satellite assemblies for the French (France) (fr-FR) and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to Russian (Russia) before calling <xref:System.Resources.ResourceManager.GetString(System.String,System.Globalization.CultureInfo)>. It then calls the <xref:System.Resources.ResourceManager.GetString*> method and the <xref:System.DateTime.ToString(System.String,System.IFormatProvider)?displayProperty=nameWithType> method and passes <xref:System.Globalization.CultureInfo> objects that represent the French (France) and Swedish (Sweden) cultures to each method. In the output, the month and day of the month as well as the string that precedes them appear in French, because the <xref:System.Resources.ResourceManager.GetString*> method is able to retrieve the French language resource. However, when the Swedish (Sweden) culture is used, the month and day of the month appear in Swedish, although the string that precedes them is in English. This is because the resource manager cannot find localized Swedish language resources, so it returns a resource for the default English culture instead. | ||
|
|
||
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. |
There was a problem hiding this comment.
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. | |
| The example requires the text-based resource files listed in the following table. Each has a single string resource named `DateStart`. |
Added missing "the".
|
|
||
| ### Example | ||
|
|
||
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. |
There was a problem hiding this comment.
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. | |
| The following example uses the <xref:System.Resources.ResourceManager.GetString*> method to retrieve culture-specific resources. It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). It then calls the <xref:System.Resources.ResourceManager.GetString*> method to retrieve the localized string, which it displays along with the current day and month. Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden). Because Swedish language resources are unavailable, the app instead uses the resources of the default culture, which is English. The example requires the text-based resource files listed in the following table. Each has a single string resource named `DateStart`. |
Added missing "the".
|
|
||
| The following example uses the <xref:System.Resources.ResourceManager.GetString(System.String,System.Globalization.CultureInfo)> method to retrieve culture-specific resources. The example's default culture is English (en), and it includes satellite assemblies for the French (France) (fr-FR) and Russian (Russia) (ru-RU) cultures. The example changes the current culture and current UI culture to Russian (Russia) before calling <xref:System.Resources.ResourceManager.GetString(System.String,System.Globalization.CultureInfo)>. It then calls the <xref:System.Resources.ResourceManager.GetString*> method and the <xref:System.DateTime.ToString(System.String,System.IFormatProvider)?displayProperty=nameWithType> method and passes <xref:System.Globalization.CultureInfo> objects that represent the French (France) and Swedish (Sweden) cultures to each method. In the output, the month and day of the month as well as the string that precedes them appear in French, because the <xref:System.Resources.ResourceManager.GetString*> method is able to retrieve the French language resource. However, when the Swedish (Sweden) culture is used, the month and day of the month appear in Swedish, although the string that precedes them is in English. This is because the resource manager cannot find localized Swedish language resources, so it returns a resource for the default English culture instead. | ||
|
|
||
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. |
There was a problem hiding this comment.
| The example requires the text-based resource files listed in following table. Each has a single string resource named `DateStart`. | |
| The example requires the text-based resource files listed in the following table. Each has a single string resource named `DateStart`. |
Added missing "the".
|
|
||
| If you want to revise a satellite assembly but not the main assembly, increment the version number on your satellite. In this case, ship a publisher policy assembly along with your satellite assembly stating that your new satellite assembly has backward compatibility with your old satellite assembly. The resource manager will still use the old contract number written into your main assembly based on the <xref:System.Resources.SatelliteContractVersionAttribute> attribute; however, the loader will bind to the satellite assembly version that is specified by the policy assembly. | ||
|
|
||
| A vendor of a shared component uses a publisher policy assembly to make a compatibility statement about a particular version of a released assembly. A publisher policy assembly is a strongly named assembly that has a name in the format `policy.<major>.<minor>.<ComponentAssemblyName>`, and is registered in the [Global Assembly Cache (GAC)](/dotnet/framework/app-domains/gac). The publisher policy is generated from an XML configuration file (see the [`<bindingRedirect>` Element](/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element)) by using the [Al.exe (Assembly Linker)](/dotnet/framework/tools/al-exe-assembly-linker) tool. The Assembly Linker is used with the `/link` option to link the XML configuration file to a manifest assembly, which is then stored in the global assembly cache. The publisher policy assemblies can be used when a vendor ships a maintenance release (service pack) that contains bug fixes.with no possibility of redeploying satellite assemblies or PRI files. |
There was a problem hiding this comment.
| A vendor of a shared component uses a publisher policy assembly to make a compatibility statement about a particular version of a released assembly. A publisher policy assembly is a strongly named assembly that has a name in the format `policy.<major>.<minor>.<ComponentAssemblyName>`, and is registered in the [Global Assembly Cache (GAC)](/dotnet/framework/app-domains/gac). The publisher policy is generated from an XML configuration file (see the [`<bindingRedirect>` Element](/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element)) by using the [Al.exe (Assembly Linker)](/dotnet/framework/tools/al-exe-assembly-linker) tool. The Assembly Linker is used with the `/link` option to link the XML configuration file to a manifest assembly, which is then stored in the global assembly cache. The publisher policy assemblies can be used when a vendor ships a maintenance release (service pack) that contains bug fixes.with no possibility of redeploying satellite assemblies or PRI files. | |
| A vendor of a shared component uses a publisher policy assembly to make a compatibility statement about a particular version of a released assembly. A publisher policy assembly is a strongly named assembly that has a name in the format `policy.<major>.<minor>.<ComponentAssemblyName>`, and is registered in the [Global Assembly Cache (GAC)](/dotnet/framework/app-domains/gac). The publisher policy is generated from an XML configuration file (see the [`<bindingRedirect>` Element](/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element)) by using the [Al.exe (Assembly Linker)](/dotnet/framework/tools/al-exe-assembly-linker) tool. The Assembly Linker is used with the `/link` option to link the XML configuration file to a manifest assembly, which is then stored in the global assembly cache. Publisher policy assemblies can be used when a vendor ships a maintenance release (service pack) that contains bug fixes, without requiring satellite assemblies or PRI files to be redeployed. |
Period where maybe a comma was intended. Seemed a little awkward. See if you think this is better.
| ## Add resources with PersistedAssemblyBuilder | ||
|
|
||
| You can call <xref:System.Reflection.Metadata.Ecma335.MetadataBuilder.AddManifestResource(System.Reflection.ManifestResourceAttributes,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.EntityHandle,System.UInt32)?displayProperty=nameWithType> to add as many resources as needed. Streams must be concatenated into one <xref:System.Reflection.Metadata.BlobBuilder> that you pass into the <xref:System.Reflection.PortableExecutable.ManagedPEBuilder> argument. | ||
| The following example shows how to create resources and attach it to the assembly that's created. |
There was a problem hiding this comment.
| The following example shows how to create resources and attach it to the assembly that's created. | |
| The following example shows how to create resources and attach them to the assembly that's created. |
Plural agreement for "resources".
wadepickett
left a comment
There was a problem hiding this comment.
Approved, but do see my minor inline suggestions
Contributes to #12613.
Also removes .NET Framework remarks.