HostWorkspaceServices Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Per workspace services provided by the host environment.
public ref class HostWorkspaceServices abstract
public abstract class HostWorkspaceServices
public abstract class HostWorkspaceServices : IDisposable
type HostWorkspaceServices = class
type HostWorkspaceServices = class
interface IDisposable
Public MustInherit Class HostWorkspaceServices
Public MustInherit Class HostWorkspaceServices
Implements IDisposable
- Inheritance
-
HostWorkspaceServices
- Implements
Remarks
Workspace services which implement IDisposable are considered ownable, in which case the owner is responsible for disposing of owned instances when they are no longer in use. When IWorkspaceService or IWorkspaceServiceFactory instances are provided directly to the HostWorkspaceServices, the owner of the instances is the type or container (e.g. a MEF export provider) which created the instances. For the specific case of ownable workspace services created by a factory (i.e. instances returned by CreateService(HostWorkspaceServices)), the Workspace is considered the owner of the resulting instance and is expected to be disposed during the call to Dispose().
Summary of lifetime rules
- IWorkspaceService instance constructed externally (e.g. MEF): Owned by the external source, and will not be automatically disposed when Workspace is disposed.
- IWorkspaceServiceFactory instance constructed externally (e.g. MEF): Owned by the external source, and will not be automatically disposed when Workspace is disposed.
- IWorkspaceService instance constructed by IWorkspaceServiceFactory within the context of HostWorkspaceServices: Owned by Workspace, and will be automatically disposed when Workspace is disposed.
Constructors
HostWorkspaceServices() |
Properties
HostServices |
The host services this workspace services originated from. |
PersistentStorage |
Obsolete.
Obsolete. Roslyn no longer supports a mechanism to perform arbitrary persistence of data. If such functionality is needed, consumers are responsible for providing it themselves with whatever semantics are needed. |
SupportedLanguages |
A list of language names for supported language services. |
TemporaryStorage |
Obsolete.
Obsolete. Roslyn no longer supports a mechanism to store arbitrary data in-memory. If such functionality is needed, consumers are responsible for providing it themselves with whatever semantics are needed. |
Workspace |
The workspace corresponding to this workspace services instantiation |
Methods
Dispose() | |
FindLanguageServices<TLanguageService>(HostWorkspaceServices+MetadataFilter) |
Finds all language services of the corresponding type across all supported languages that match the filter criteria. |
GetLanguageServices(String) |
Gets the HostLanguageServices for the language name. |
GetRequiredService<TWorkspaceService>() |
Gets a workspace specific service provided by the host identified by the service type. If the host does not provide the service, this method throws InvalidOperationException. |
GetService<TWorkspaceService>() |
Gets a workspace specific service provided by the host identified by the service type. If the host does not provide the service, this method returns null. |
IsSupported(String) |
Returns true if the language is supported. |
Applies to
.NET