Skip to content

Commit

Permalink
Update AssesmblyBuilder.DefineDynamicModule to call out that .NET Cor…
Browse files Browse the repository at this point in the history
…e/5+ only supports one module per assembly (#10057)

* Update AssesmblyBuilder.DefineDynamicModule to call out that .NET Core/5+ only supports one module per assembly

* Update xml/System.Reflection.Emit/AssemblyBuilder.xml

Co-authored-by: Jan Kotas <jkotas@microsoft.com>

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
  • Loading branch information
elinor-fung and jkotas committed Jun 25, 2024
1 parent 8711385 commit d6d38e4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions xml/System.Reflection.Emit/AssemblyBuilder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,9 @@ The following code example shows how to define and use a dynamic assembly. The e
<format type="text/markdown"><![CDATA[
## Remarks
It is an error to define multiple dynamic modules with the same name in an assembly.
.NET Core and .NET 5+ only: [Multi-module assemblies are not supported](/dotnet/core/porting/net-framework-tech-unavailable#loading-multi-module-assemblies). Only one dynamic module may be defined in an assembly.
.NET Framework only: It is an error to define multiple dynamic modules with the same name in an assembly.
The defined dynamic module is transient. The dynamic module is not saved, even if the parent dynamic assembly was created with <xref:System.Reflection.Emit.AssemblyBuilderAccess.RunAndSave>.
Expand Down Expand Up @@ -607,9 +609,15 @@ The following code example shows how to define and use a dynamic assembly. The e

-or-

The length of <paramref name="name" /> is greater than the system-defined maximum length.</exception>
The length of <paramref name="name" /> is greater than the system-defined maximum length.

-or-

.NET Framework only: A module with the same <paramref name="name" /> has already been defined in this assembly.
</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="name" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">.NET Core and .NET 5+ only: A dynamic module has already been defined in this assembly.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<exception cref="T:System.ExecutionEngineException">The assembly for default symbol writer cannot be loaded.

Expand Down Expand Up @@ -916,7 +924,7 @@ The following code example shows how to define and use a dynamic assembly. The e
<param name="name">The name of the dynamic module.</param>
<summary>When overridden in a derived class, defines a dynamic module in this assembly.</summary>
<returns>A <see cref="T:System.Reflection.Emit.ModuleBuilder" /> representing the defined dynamic module.</returns>
<remarks>.NET Core supports only one module.</remarks>
<remarks>.NET Core and .NET 5+ support only one module per assembly.</remarks>
</Docs>
</Member>
<MemberGroup MemberName="DefineResource">
Expand Down Expand Up @@ -1772,7 +1780,7 @@ The following code example shows how to define and use a dynamic assembly. The e
<param name="name">The name of the requested dynamic module.</param>
<summary>When overridden in a derived class, returns the dynamic module with the specified name.</summary>
<returns>A <see cref="T:System.Reflection.Emit.ModuleBuilder" /> representing the requested dynamic module.</returns>
<remarks>.NET Core supports only one module.</remarks>
<remarks>.NET Core and .NET 5+ support only one module per assembly..</remarks>
</Docs>
</Member>
<Member MemberName="GetExportedTypes">
Expand Down

0 comments on commit d6d38e4

Please sign in to comment.