提交 ad8568ac 编写于 作者: J Jason Malinowski

Don't use MEF to discover a type that's in the same assembly as us

These used to be split up into separate assemblies, but aren't anymore.
上级 75888603
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.VisualStudio.LanguageServices.Setup
{
/// <summary>
/// This interface allows the host to set up a telemetry service during package initialization.
/// </summary>
internal interface IRoslynTelemetrySetup
{
void Initialize(IServiceProvider serviceProvider);
}
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
using static Microsoft.CodeAnalysis.Utilities.ForegroundThreadDataKind; using static Microsoft.CodeAnalysis.Utilities.ForegroundThreadDataKind;
using Task = System.Threading.Tasks.Task; using Task = System.Threading.Tasks.Task;
using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.LanguageServices.Telemetry;
namespace Microsoft.VisualStudio.LanguageServices.Setup namespace Microsoft.VisualStudio.LanguageServices.Setup
{ {
...@@ -69,11 +70,7 @@ protected override void Initialize() ...@@ -69,11 +70,7 @@ protected override void Initialize()
// Ensure the options persisters are loaded since we have to fetch options from the shell // Ensure the options persisters are loaded since we have to fetch options from the shell
componentModel.GetExtensions<IOptionPersister>(); componentModel.GetExtensions<IOptionPersister>();
var telemetrySetupExtensions = componentModel.GetExtensions<IRoslynTelemetrySetup>(); RoslynTelemetrySetup.Initialize(this);
foreach (var telemetrySetup in telemetrySetupExtensions)
{
telemetrySetup.Initialize(this);
}
// set workspace output pane // set workspace output pane
_outputPane = new WorkspaceFailureOutputPane(this, _workspace); _outputPane = new WorkspaceFailureOutputPane(this, _workspace);
......
...@@ -165,7 +165,6 @@ ...@@ -165,7 +165,6 @@
<Compile Include="Implementation\Workspace\VisualStudioNavigationOptions.cs" /> <Compile Include="Implementation\Workspace\VisualStudioNavigationOptions.cs" />
<Compile Include="Implementation\Workspace\VisualStudioNavigationOptionsProvider.cs" /> <Compile Include="Implementation\Workspace\VisualStudioNavigationOptionsProvider.cs" />
<Compile Include="Implementation\Workspace\VisualStudioProjectCacheHostServiceFactory.cs" /> <Compile Include="Implementation\Workspace\VisualStudioProjectCacheHostServiceFactory.cs" />
<Compile Include="IRoslynTelemetrySetup.cs" />
<Compile Include="Packaging\Interop\SVsRemoteControlService.cs" /> <Compile Include="Packaging\Interop\SVsRemoteControlService.cs" />
<Compile Include="Packaging\IPackageServicesProxy.cs" /> <Compile Include="Packaging\IPackageServicesProxy.cs" />
<Compile Include="Storage\VisualStudioPersistentStorageLocationService.cs" /> <Compile Include="Storage\VisualStudioPersistentStorageLocationService.cs" />
......
...@@ -11,10 +11,9 @@ ...@@ -11,10 +11,9 @@
namespace Microsoft.VisualStudio.LanguageServices.Telemetry namespace Microsoft.VisualStudio.LanguageServices.Telemetry
{ {
[Export(typeof(IRoslynTelemetrySetup))] internal static class RoslynTelemetrySetup
internal class RoslynTelemetrySetup : IRoslynTelemetrySetup
{ {
public void Initialize(IServiceProvider serviceProvider) public static void Initialize(IServiceProvider serviceProvider)
{ {
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
var optionService = componentModel.GetService<IGlobalOptionService>(); var optionService = componentModel.GetService<IGlobalOptionService>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册