Поделиться через


AssemblyBuilder.DefineDynamicModule Method (String, Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines a named transient dynamic module in this assembly and specifies whether symbol information should be emitted.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function DefineDynamicModule ( _
    name As String, _
    emitSymbolInfo As Boolean _
) As ModuleBuilder
[SecuritySafeCriticalAttribute]
public ModuleBuilder DefineDynamicModule(
    string name,
    bool emitSymbolInfo
)

Parameters

  • name
    Type: System.String
    The name of the dynamic module. Must be less than 260 characters long.
  • emitSymbolInfo
    Type: System.Boolean
    true to emit symbol information; otherwise, false.

Return Value

Type: System.Reflection.Emit.ModuleBuilder
The new dynamic module.

Exceptions

Exception Condition
ArgumentException

name begins with white space.

-or-

The length of name is zero.

-or-

The length of name is greater than or equal to 260.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

ExecutionEngineException

The assembly for the default symbol writer cannot be loaded.

-or-

The type that implements the default symbol writer interface cannot be found.

InvalidOperationException

A dynamic module has already been created in this assembly.

Remarks

In Silverlight-based applications, you can define only one dynamic module in an assembly.

NoteNote:

To suppress optimizations when you debug dynamic modules, apply the DebuggableAttribute attribute to the dynamic assembly before you call DefineDynamicModule. Create an instance of DebuggableAttribute with the DisableOptimizations flag and apply it using the SetCustomAttribute method. The attribute must be applied to the dynamic assembly. It has no effect if it is applied to the module.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.