IMetaDataDispenser::OpenScope Method
Opens an existing, on-disk file and maps its metadata into memory.
HRESULT OpenScope (
[in] LPCWSTR szScope,
[in] DWORD dwOpenFlags,
[in] REFIID riid,
[out] IUnknown **ppIUnk
);
The in-memory copy of the metadata can be queried using methods from one of the "import" interfaces, or added to using methods from the one of the "emit" interfaces.
If the target file does not contain CLR metadata, the OpenScope method will fail.
In the .NET Framework version 1.0 and version 1.1, if a scope is opened with dwOpenFlags set to ofRead, it is eligible for sharing. That is, if subsequent calls to OpenScope pass in the name of a file that was previously opened, the existing scope is reused and a new set of data structures is not created. However, problems can arise due to this sharing.
In the .NET Framework version 2.0, scopes opened with dwOpenFlags set to ofRead are no longer shared. Use the ofReadOnly value to allow the scope to be shared. When a scope is shared, queries that use "read/write" metadata interfaces will fail.
Platforms: See .NET Framework System Requirements.
Header: Cor.h
Library: Used as a resource in MsCorEE.dll
.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0