提交 4cfd159c 编写于 作者: R robinsedlaczek

Call GetRequiredService when creating Workspace in order to get exception in...

Call GetRequiredService when creating Workspace in order to get exception in case a service is missing.
上级 abaeff6a
......@@ -38,7 +38,7 @@ public abstract class HostWorkspaceServices
var service = GetService<TWorkspaceService>();
if (service == null)
{
throw new InvalidOperationException(WorkspacesResources.WorkspaceServicesUnavailable);
throw new InvalidOperationException(string.Format(WorkspacesResources.WorkspaceServicesUnavailable, typeof(TWorkspaceService).FullName));
}
return service;
......
......@@ -59,7 +59,7 @@ protected Workspace(HostServices host, string workspaceKind)
_services = host.CreateWorkspaceServices(this);
// queue used for sending events
var workspaceTaskSchedulerFactory = _services.GetService<IWorkspaceTaskSchedulerFactory>();
var workspaceTaskSchedulerFactory = _services.GetRequiredService<IWorkspaceTaskSchedulerFactory>();
_taskQueue = workspaceTaskSchedulerFactory.CreateTaskQueue();
// initialize with empty solution
......
......@@ -1079,7 +1079,7 @@ internal class WorkspacesResources {
}
/// <summary>
/// Looks up a localized string similar to Services required to accomplish the task are not available from the workspace..
/// Looks up a localized string similar to Service of type &apos;{0}&apos; is required to accomplish the task but is not available from the workspace..
/// </summary>
internal static string WorkspaceServicesUnavailable {
get {
......
......@@ -397,7 +397,7 @@
<value>Removing project references is not supported.</value>
</data>
<data name="WorkspaceServicesUnavailable" xml:space="preserve">
<value>Services required to accomplish the task are not available from the workspace.</value>
<value>Service of type '{0}' is required to accomplish the task but is not available from the workspace.</value>
</data>
<data name="DiagnosticCannotBeNull" xml:space="preserve">
<value>Supplied diagnostic cannot be null.</value>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册