Share via


ICorDebugModule2::ApplyChanges Method

Applies the changes in the metadata and the changes in the Microsoft intermediate language (MSIL) code to the running process.

HRESULT ApplyChanges (
    [in] ULONG                       cbMetadata,
    [in, size_is(cbMetadata)] BYTE   pbMetadata[],
    [in] ULONG                       cbIL,
    [in, size_is(cbIL)] BYTE         pbIL[]
);

Parameters

  • cbMetadata
    [in] Size, in bytes, of the delta metadata.

  • pbMetadata
    [in] Buffer that contains the delta metadata. The address of the buffer is returned from the IMetaDataEmit2::SaveDeltaToMemory method.

    The relative virtual addresses (RVAs) in the metadata should be relative to the start of the MSIL code.

  • cbIL
    [in] Size, in bytes, of the delta MSIL code.

  • pbIL
    [in] Buffer that contains the delta MSIL code.

Remarks

If the ApplyChanges method fails, the debug session is in an invalid state and must be restarted.

When the delta MSIL and the metadata have been created in the debugger’s memory, the debugger calls ApplyChanges to send the changes into the common language runtime (CLR). The runtime updates its metadata tables, places the new MSIL into the process, and sets up a just-in-time (JIT) compilation of the new MSIL. When the changes have been applied, the debugger should call IMetaDataEmit2::ResetENCLog to prepare for the next editing session. The debugger may then continue the process.

Whenever the debugger calls ApplyChanges on a module that has delta metadata, it should also call IMetaDataEmit::ApplyEditAndContinue with the same delta metadata on all of its copies of that module’s metadata except for the copy used to emit the changes. If a copy of the metadata somehow becomes out-of-sync with the actual metadata, the debugger can always throw away that copy and obtain a new copy.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Concepts

ICorDebugModule2 Interface

ICorDebugModule Interface