AsyncPackage AsyncPackage AsyncPackage Class

Definition

Represents a VSPackage that can handle asynchronous services.

[System.Runtime.InteropServices.ComVisible(true)]
public abstract class AsyncPackage : Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.IAsyncServiceContainer, Microsoft.VisualStudio.Shell.IAsyncServiceProvider, Microsoft.VisualStudio.Shell.IAsyncServiceProvider2, Microsoft.VisualStudio.Shell.Interop.IAsyncLoadablePackageInitialize, Microsoft.VisualStudio.Shell.Interop.IAsyncServiceProvider, Microsoft.VisualStudio.Shell.Interop.IVsAsyncToolWindowFactory, Microsoft.VisualStudio.Shell.Interop.IVsAsyncToolWindowFactoryProvider
type AsyncPackage = class
    inherit Package
    interface IAsyncServiceProvider
    interface IAsyncLoadablePackageInitialize
    interface IAsyncServiceProvider2
    interface IAsyncServiceProvider
    interface IAsyncServiceContainer
    interface IVsAsyncToolWindowFactory
    interface IVsAsyncToolWindowFactoryProvider
Public MustInherit Class AsyncPackage
Inherits Package
Implements IAsyncLoadablePackageInitialize, IAsyncServiceContainer, IAsyncServiceProvider, IAsyncServiceProvider, IAsyncServiceProvider2, IVsAsyncToolWindowFactory, IVsAsyncToolWindowFactoryProvider
Inheritance
AsyncPackageAsyncPackageAsyncPackage
Derived
Attributes
Implements

Constructors

AsyncPackage() AsyncPackage() AsyncPackage()

Initializes a new instance of AsyncPackage.

Properties

ApplicationRegistryRoot ApplicationRegistryRoot ApplicationRegistryRoot

Gets the root registry key of the current Visual Studio registry hive.

(Inherited from Package)
DisposalToken DisposalToken DisposalToken

Exposes a CancellationToken that can be used to check if the package has been disposed. This can happen for asynchronous tasks that are running on a background thread when Visual Studio has started to shut down.

JoinableTaskCollection JoinableTaskCollection JoinableTaskCollection

Gets a JoinableTaskCollectionof asynchronous tasks started by this package.

JoinableTaskFactory JoinableTaskFactory JoinableTaskFactory

Gets the factory to use for asynchronous tasks started by this package.

UserDataPath UserDataPath UserDataPath

Gets the path to user data storage for Visual Studio.

(Inherited from Package)
UserLocalDataPath UserLocalDataPath UserLocalDataPath

Gets the path to local user data storage for Visual Studio.

(Inherited from Package)
UserRegistryRoot UserRegistryRoot UserRegistryRoot

Gets a registry key that can be used to store user data.

(Inherited from Package)
Zombied Zombied Zombied

Gets a value indicating whether the package in the process of shutdown.

(Inherited from Package)

Methods

AddOptionKey(String) AddOptionKey(String) AddOptionKey(String)

Adds a user option key name into the list of option keys.

(Inherited from Package)
AddService(Type, AsyncServiceCreatorCallback) AddService(Type, AsyncServiceCreatorCallback) AddService(Type, AsyncServiceCreatorCallback)

Adds an async service to this package. This service is no visible outside of this package.

AddService(Type, AsyncServiceCreatorCallback, Boolean) AddService(Type, AsyncServiceCreatorCallback, Boolean) AddService(Type, AsyncServiceCreatorCallback, Boolean)

Adds an async service to this package. This service may or may not be visible outside of this package, depending on the value of promote.

AddService(Type, AsyncServiceCreatorWithProgressCallback) AddService(Type, AsyncServiceCreatorWithProgressCallback) AddService(Type, AsyncServiceCreatorWithProgressCallback)

Adds an async service to this package. This service is not visible outside this package.

AddService(Type, AsyncServiceCreatorWithProgressCallback, Boolean) AddService(Type, AsyncServiceCreatorWithProgressCallback, Boolean) AddService(Type, AsyncServiceCreatorWithProgressCallback, Boolean)

Adds an async service to this package. This service may or may not be visible outside of this package, depending on the value of promote.

CreateInstance(Guid, Guid, Type) CreateInstance(Guid, Guid, Type) CreateInstance(Guid, Guid, Type)

Creates the specified COM object using the Visual Studio's local registry CLSID object.

(Inherited from Package)
CreateTool(Guid) CreateTool(Guid) CreateTool(Guid)

Enables derived classes to provide an implementation if necessary.

(Inherited from Package)
CreateToolWindow(Guid, Int32) CreateToolWindow(Guid, Int32) CreateToolWindow(Guid, Int32)

Creates a tool window of the specified type with the specified ID.

(Inherited from Package)
CreateToolWindow(Type, Int32) CreateToolWindow(Type, Int32) CreateToolWindow(Type, Int32)

Creates a tool window of the specified type with the specified ID.

(Inherited from Package)
CreateToolWindow(Type, Int32, Object) CreateToolWindow(Type, Int32, Object) CreateToolWindow(Type, Int32, Object) Inherited from Package
CreateToolWindow(Type, Int32, UInt32) CreateToolWindow(Type, Int32, UInt32) CreateToolWindow(Type, Int32, UInt32)

Creates a tool window of the specified type with the specified ID.

(Inherited from Package)
CreateToolWindow(Type, Int32, UInt32, Object, Guid) CreateToolWindow(Type, Int32, UInt32, Object, Guid) CreateToolWindow(Type, Int32, UInt32, Object, Guid) Inherited from Package
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Disposes the object and the associated cancellation token.

FindToolWindow(Type, Int32, Boolean) FindToolWindow(Type, Int32, Boolean) FindToolWindow(Type, Int32, Boolean)

Gets the tool window corresponding to the specified type and ID.

(Inherited from Package)
FindToolWindowAsync(Type, Int32, Boolean, CancellationToken) FindToolWindowAsync(Type, Int32, Boolean, CancellationToken) FindToolWindowAsync(Type, Int32, Boolean, CancellationToken)
FindWindowPane(Type, Int32, Boolean) FindWindowPane(Type, Int32, Boolean) FindWindowPane(Type, Int32, Boolean)

Gets the window pane corresponding to the specified type and ID, and if no window pane of that type exists creates one if told to do so.

(Inherited from Package)
FindWindowPaneAsync(Type, Int32, Boolean, CancellationToken) FindWindowPaneAsync(Type, Int32, Boolean, CancellationToken) FindWindowPaneAsync(Type, Int32, Boolean, CancellationToken)
GetAsyncToolWindowFactory(Guid) GetAsyncToolWindowFactory(Guid) GetAsyncToolWindowFactory(Guid)
GetAutomationObject(String) GetAutomationObject(String) GetAutomationObject(String)

Gets the automation object for the VSPackage.

(Inherited from Package)
GetDialogPage(Type) GetDialogPage(Type) GetDialogPage(Type)

Gets the requested dialog page.

(Inherited from Package)
GetOutputPane(Guid, String) GetOutputPane(Guid, String) GetOutputPane(Guid, String)

Gets the requested output window.

(Inherited from Package)
GetProviderLocale() GetProviderLocale() GetProviderLocale()

Returns the locale associated with this service provider.

(Inherited from Package)
GetService(Type) GetService(Type) GetService(Type)

Retrieves a service registered with this package. This method is synchronous and even async services retrieved this way will be retrieved synchronously.

GetServiceAsync(Type) GetServiceAsync(Type) GetServiceAsync(Type)
GetServiceAsync(Type, Boolean) GetServiceAsync(Type, Boolean) GetServiceAsync(Type, Boolean)
GetToolboxItemData(String, DataFormats+Format) GetToolboxItemData(String, DataFormats+Format) GetToolboxItemData(String, DataFormats+Format)

Gets the content of the data format for the specified toolbox item ID and data format.

(Inherited from Package)
GetToolboxItemDataAsync(String, DataFormats+Format) GetToolboxItemDataAsync(String, DataFormats+Format) GetToolboxItemDataAsync(String, DataFormats+Format) Inherited from Package
Initialize() Initialize() Initialize()

Seal this method. Due to an almost unavoidable risk of deadlock, SetSite (which is what calls Initialize) still occurs on the UI thread even for async package. Since most async package authors would, logically, assume that Initialize happens on a b/g thread they may do expensive (synchronous) things inside of their override, defeating some of the benefit of async loads. To help lead them away from that we will seal it and thus all they can override is async initialize, which is called on the b/g thread.

InitializeAsync(CancellationToken, IProgress<ServiceProgressData>) InitializeAsync(CancellationToken, IProgress<ServiceProgressData>) InitializeAsync(CancellationToken, IProgress<ServiceProgressData>)
InitializeToolWindowAsync(Type, Int32, CancellationToken) InitializeToolWindowAsync(Type, Int32, CancellationToken) InitializeToolWindowAsync(Type, Int32, CancellationToken)
InstantiateToolWindow(Type) InstantiateToolWindow(Type) InstantiateToolWindow(Type) Inherited from Package
InstantiateToolWindow(Type, Object) InstantiateToolWindow(Type, Object) InstantiateToolWindow(Type, Object) Inherited from Package
IsLocalService(Type) IsLocalService(Type) IsLocalService(Type)

Determines whether the specified service type can be retrieved without requiring an RPC transition to the UI thread.

(Inherited from Package)
OnLoadOptions(String, Stream) OnLoadOptions(String, Stream) OnLoadOptions(String, Stream)

Invoked by the package class when there are options to be read out of the solution file.

(Inherited from Package)
OnSaveOptions(String, Stream) OnSaveOptions(String, Stream) OnSaveOptions(String, Stream)

Invoked by the Package class when there are options to be saved to the solution file.

(Inherited from Package)
ParseToolboxResource(TextReader, Guid) ParseToolboxResource(TextReader, Guid) ParseToolboxResource(TextReader, Guid)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

(Inherited from Package)
ParseToolboxResource(TextReader, ResourceManager) ParseToolboxResource(TextReader, ResourceManager) ParseToolboxResource(TextReader, ResourceManager)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

(Inherited from Package)
QueryClose(Boolean) QueryClose(Boolean) QueryClose(Boolean)

Called to ask the package if the shell can be closed.

(Inherited from Package)
RegisterEditorFactory(IVsEditorFactory) RegisterEditorFactory(IVsEditorFactory) RegisterEditorFactory(IVsEditorFactory)

Registers an editor factory with Visual Studio.

(Inherited from Package)
RegisterProjectFactory(IVsProjectFactory) RegisterProjectFactory(IVsProjectFactory) RegisterProjectFactory(IVsProjectFactory)

Registers a project factory with Visual Studio.

(Inherited from Package)
RemoveService(Type) RemoveService(Type) RemoveService(Type)

Removes an async service registered with this package.

RemoveService(Type, Boolean) RemoveService(Type, Boolean) RemoveService(Type, Boolean)

Removes an async service registered with this package.

ShowOptionPage(Type) ShowOptionPage(Type) ShowOptionPage(Type)

Displays a specified tools options page.

(Inherited from Package)
ShowToolWindowAsync(Type, Int32, Boolean, CancellationToken) ShowToolWindowAsync(Type, Int32, Boolean, CancellationToken) ShowToolWindowAsync(Type, Int32, Boolean, CancellationToken)

Explicit Interface Implementations

IAsyncLoadablePackageInitialize.Initialize(IAsyncServiceProvider, IProfferAsyncService, IAsyncProgressCallback) IAsyncLoadablePackageInitialize.Initialize(IAsyncServiceProvider, IProfferAsyncService, IAsyncProgressCallback) IAsyncLoadablePackageInitialize.Initialize(IAsyncServiceProvider, IProfferAsyncService, IAsyncProgressCallback)

Async version of SetSite, called from a background thread.

IAsyncServiceProvider.QueryServiceAsync(Guid) IAsyncServiceProvider.QueryServiceAsync(Guid) IAsyncServiceProvider.QueryServiceAsync(Guid)

Gets the async service, if it is available.

IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr) IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr) IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Executes a specified command or displays help for a command.

(Inherited from Package)
IOleCommandTarget.QueryStatus(Guid, UInt32, OLECMD[], IntPtr) IOleCommandTarget.QueryStatus(Guid, UInt32, OLECMD[], IntPtr) IOleCommandTarget.QueryStatus(Guid, UInt32, OLECMD[], IntPtr)

Queries the object for the status of one or more commands generated by user interface events.

(Inherited from Package)
IServiceContainer.AddService(Type, Object) IServiceContainer.AddService(Type, Object) IServiceContainer.AddService(Type, Object)

Adds the given service to the VSPackage's service container.

(Inherited from Package)
IServiceContainer.AddService(Type, Object, Boolean) IServiceContainer.AddService(Type, Object, Boolean) IServiceContainer.AddService(Type, Object, Boolean)

Adds the given service to the VSPackage's service container.

(Inherited from Package)
IServiceContainer.AddService(Type, ServiceCreatorCallback) IServiceContainer.AddService(Type, ServiceCreatorCallback) IServiceContainer.AddService(Type, ServiceCreatorCallback)

Adds the given service to the VSPackage's service container.

(Inherited from Package)
IServiceContainer.AddService(Type, ServiceCreatorCallback, Boolean) IServiceContainer.AddService(Type, ServiceCreatorCallback, Boolean) IServiceContainer.AddService(Type, ServiceCreatorCallback, Boolean)

Adds the given service to the service container by means of the specified ServiceCreatorCallback.

(Inherited from Package)
IServiceContainer.RemoveService(Type) IServiceContainer.RemoveService(Type) IServiceContainer.RemoveService(Type)

Removes the given service type from the service container.

(Inherited from Package)
IServiceContainer.RemoveService(Type, Boolean) IServiceContainer.RemoveService(Type, Boolean) IServiceContainer.RemoveService(Type, Boolean)

Removes the given service type from the service container, and optionally promotes the removal of the service to parent service containers.

(Inherited from Package)
IServiceProvider.GetService(Type) IServiceProvider.GetService(Type) IServiceProvider.GetService(Type)

Gets the service of the specified type.

(Inherited from Package)
IServiceProvider.QueryService(Guid, Guid, IntPtr) IServiceProvider.QueryService(Guid, Guid, IntPtr) IServiceProvider.QueryService(Guid, Guid, IntPtr)

Internal IServiceProvider implementation.

(Inherited from Package)
IVsAsyncToolWindowFactory.CreateToolWindow(Guid, UInt32, Object) IVsAsyncToolWindowFactory.CreateToolWindow(Guid, UInt32, Object) IVsAsyncToolWindowFactory.CreateToolWindow(Guid, UInt32, Object)
IVsAsyncToolWindowFactory.InitializeToolWindowAsync(Guid, UInt32) IVsAsyncToolWindowFactory.InitializeToolWindowAsync(Guid, UInt32) IVsAsyncToolWindowFactory.InitializeToolWindowAsync(Guid, UInt32)
IVsPackage.Close() IVsPackage.Close() IVsPackage.Close()

Closes and disposes the package.

(Inherited from Package)
IVsPackage.GetAutomationObject(String, Object) IVsPackage.GetAutomationObject(String, Object) IVsPackage.GetAutomationObject(String, Object)

Gets an automation-friendly object for this package.

(Inherited from Package)
IVsPackage.GetPropertyPage(Guid, VSPROPSHEETPAGE[]) IVsPackage.GetPropertyPage(Guid, VSPROPSHEETPAGE[]) IVsPackage.GetPropertyPage(Guid, VSPROPSHEETPAGE[])

Proffers access to the Tools menu Options and the property pages of the Customize Toolbox dialog boxes.

(Inherited from Package)
IVsPackage.QueryClose(Int32) IVsPackage.QueryClose(Int32) IVsPackage.QueryClose(Int32)

Called to ask the VSPackage if the Visual Studio shell can be closed.

(Inherited from Package)
IVsPackage.ResetDefaults(UInt32) IVsPackage.ResetDefaults(UInt32) IVsPackage.ResetDefaults(UInt32)

Resets Toolbox defaults.

(Inherited from Package)
IVsPackage.SetSite(IServiceProvider) IVsPackage.SetSite(IServiceProvider) IVsPackage.SetSite(IServiceProvider)

Initializes the VSPackage in the Visual Studio environment.

(Inherited from Package)
IVsPersistSolutionOpts.LoadUserOptions(IVsSolutionPersistence, UInt32) IVsPersistSolutionOpts.LoadUserOptions(IVsSolutionPersistence, UInt32) IVsPersistSolutionOpts.LoadUserOptions(IVsSolutionPersistence, UInt32)

Loads user options for a given solution.

(Inherited from Package)
IVsPersistSolutionOpts.ReadUserOptions(IStream, String) IVsPersistSolutionOpts.ReadUserOptions(IStream, String) IVsPersistSolutionOpts.ReadUserOptions(IStream, String)

Reads user options for a given solution.

(Inherited from Package)
IVsPersistSolutionOpts.SaveUserOptions(IVsSolutionPersistence) IVsPersistSolutionOpts.SaveUserOptions(IVsSolutionPersistence) IVsPersistSolutionOpts.SaveUserOptions(IVsSolutionPersistence)

Saves user options for a given solution.

(Inherited from Package)
IVsPersistSolutionOpts.WriteUserOptions(IStream, String) IVsPersistSolutionOpts.WriteUserOptions(IStream, String) IVsPersistSolutionOpts.WriteUserOptions(IStream, String)

Writes user options for a given solution.

(Inherited from Package)
IVsToolWindowFactory.CreateToolWindow(Guid, UInt32) IVsToolWindowFactory.CreateToolWindow(Guid, UInt32) IVsToolWindowFactory.CreateToolWindow(Guid, UInt32)

Creates a tool window of the specified type with the specified ID.

(Inherited from Package)
IVsToolboxItemProvider.GetItemContent(String, UInt16, IntPtr) IVsToolboxItemProvider.GetItemContent(String, UInt16, IntPtr) IVsToolboxItemProvider.GetItemContent(String, UInt16, IntPtr)

Gets an item.

(Inherited from Package)
IVsToolboxItemProvider2.GetItemContentAsync(String, UInt16) IVsToolboxItemProvider2.GetItemContentAsync(String, UInt16) IVsToolboxItemProvider2.GetItemContentAsync(String, UInt16) Inherited from Package
IVsUserSettings.ExportSettings(String, IVsSettingsWriter) IVsUserSettings.ExportSettings(String, IVsSettingsWriter) IVsUserSettings.ExportSettings(String, IVsSettingsWriter)

This method implements the IVsUserSettings Interface used to manage profiles and import/export settings to XML files.

(Inherited from Package)
IVsUserSettings.ImportSettings(String, IVsSettingsReader, UInt32, Int32) IVsUserSettings.ImportSettings(String, IVsSettingsReader, UInt32, Int32) IVsUserSettings.ImportSettings(String, IVsSettingsReader, UInt32, Int32)

Retrieves a VSPackage's configuration using the Visual Studio settings mechanism when a user selects the import option of the Import/Export Settings feature on the IDE’s Tools menu. This method is part of the implementation of the IVsUserSettings interface used to manage profiles and import/export settings to XML files.

(Inherited from Package)
IVsUserSettingsMigration.MigrateSettings(IVsSettingsReader, IVsSettingsWriter, String) IVsUserSettingsMigration.MigrateSettings(IVsSettingsReader, IVsSettingsWriter, String) IVsUserSettingsMigration.MigrateSettings(IVsSettingsReader, IVsSettingsWriter, String)

Migrates settings from a previous version.

(Inherited from Package)
IVsUserSettingsQuery.NeedExport(String, Int32) IVsUserSettingsQuery.NeedExport(String, Int32) IVsUserSettingsQuery.NeedExport(String, Int32)

Determines whether settings have changed and should be re-exported.

(Inherited from Package)

Events

ToolboxInitialized ToolboxInitialized ToolboxInitialized

Event generated whenever Visual Studio initializes its Toolbox.

(Inherited from Package)
ToolboxUpgraded ToolboxUpgraded ToolboxUpgraded

Event generated whenever Visual Studio upgrades its Toolbox.

(Inherited from Package)

Extension Methods

FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)
FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)
FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)
IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>) IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>) IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

QueryService(IServiceProvider, Guid) QueryService(IServiceProvider, Guid) QueryService(IServiceProvider, Guid)

Gets a service exposed by a service provider based on its service type.

QueryService<TService>(IServiceProvider) QueryService<TService>(IServiceProvider) QueryService<TService>(IServiceProvider)

Gets a service exposed by a service provider based on its service type.

Applies to