Bagikan melalui


IVsRunningDocumentTable4.GetDocumentData Method

This is functionally identical to calling GetDocumentInfo and requesting only the document data, but this method easier to consume from managed code.

There are two pending states for a document:

RDT_PendingHierarchyInitialization: The project that owns the document hasn’t yet been loaded. This can happen only during asynchronous solution load (ASL). As individual projects are loaded, the documents owned by the projects are updated to remove the RDT_PendingHierarchyInitialization flag. By the time the solution is fully loaded, no documents are in this state.

RDT_PendingInitialization: The document data hasn’t been loaded, and the view hasn’t been created. A document in this state may or may not also have RDT_PendingHierarchyInitialization, but a document with RDT_PendingHierarchyInitialization always has RDT_PendingInitialization. Documents in this state are referred to as lazy or stub documents.

This method causes a lazy document to be loaded immediately, so by the time it returns, the document no longer has the RDT_PendingInitialization flag.

You should first call GetDocumentFlags and call GetDocumentData only if the document doesn’t have RDT_PendingInitialization among its flags. You can be notified that the document has been loaded by subscribing to running document table events and looking for the RDTA_DocumentInitialized flag in OnAfterAttributeChange or OnAfterAttributeChangeEx.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assemblies:   Microsoft.VisualStudio.Shell.Interop.12.0 (in Microsoft.VisualStudio.Shell.Interop.12.0.dll)
  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Function GetDocumentData ( _
    cookie As UInteger _
) As Object
Object GetDocumentData(
    uint cookie
)
Object^ GetDocumentData(
    [InAttribute] unsigned int cookie
)
abstract GetDocumentData : 
        cookie:uint32 -> Object
function GetDocumentData(
    cookie : uint
) : Object

Parameters

  • cookie
    Type: UInt32

    The document cookie.

Return Value

Type: Object
The document data.

.NET Framework Security

See Also

Reference

IVsRunningDocumentTable4 Interface

Microsoft.VisualStudio.Shell.Interop Namespace