提交 12fa199e 编写于 作者: S Sam Harwell

Avoid constructing CSharpSendToInteractiveSubmissionProvider outside the MEF catalog

上级 58987316
......@@ -5,11 +5,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.Interactive;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
......@@ -20,7 +20,7 @@ internal sealed class CSharpSendToInteractiveSubmissionProvider
: AbstractSendToInteractiveSubmissionProvider
{
[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpSendToInteractiveSubmissionProvider()
{
}
......
......@@ -6,7 +6,6 @@
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.CommandHandlers;
using Microsoft.CodeAnalysis.Editor.CSharp.Interactive;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Interactive;
using Microsoft.CodeAnalysis.Host.Mef;
......@@ -28,6 +27,7 @@ internal sealed class CSharpInteractiveCommandHandler : InteractiveCommandHandle
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpInteractiveCommandHandler(
CSharpVsInteractiveWindowProvider interactiveWindowProvider,
ISendToInteractiveSubmissionProvider sendToInteractiveSubmissionProvider,
IContentTypeRegistryService contentTypeRegistryService,
IEditorOptionsFactoryService editorOptionsFactoryService,
IEditorOperationsFactoryService editorOperationsFactoryService,
......@@ -35,7 +35,7 @@ internal sealed class CSharpInteractiveCommandHandler : InteractiveCommandHandle
: base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService, waitIndicator)
{
_interactiveWindowProvider = interactiveWindowProvider;
_sendToInteractiveSubmissionProvider = new CSharpSendToInteractiveSubmissionProvider();
_sendToInteractiveSubmissionProvider = sendToInteractiveSubmissionProvider;
}
protected override ISendToInteractiveSubmissionProvider SendToInteractiveSubmissionProvider => _sendToInteractiveSubmissionProvider;
......
......@@ -45,6 +45,7 @@ public InteractiveWindowCommandHandlerTestState(ExportProvider exportProvider, X
_commandHandler = new TestInteractiveCommandHandler(
TestHost.Window,
GetExportedValue<ISendToInteractiveSubmissionProvider>(),
GetExportedValue<IContentTypeRegistryService>(),
GetExportedValue<IEditorOptionsFactoryService>(),
GetExportedValue<IEditorOperationsFactoryService>(),
......
......@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Editor.CSharp.Interactive;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Interactive;
using Microsoft.VisualStudio.InteractiveWindow;
......@@ -20,6 +19,7 @@ internal class TestInteractiveCommandHandler : InteractiveCommandHandler
public TestInteractiveCommandHandler(
IInteractiveWindow interactiveWindow,
ISendToInteractiveSubmissionProvider sendToInteractiveSubmissionProvider,
IContentTypeRegistryService contentTypeRegistryService,
IEditorOptionsFactoryService editorOptionsFactoryService,
IEditorOperationsFactoryService editorOperationsFactoryService,
......@@ -27,7 +27,7 @@ internal class TestInteractiveCommandHandler : InteractiveCommandHandler
: base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService, waitIndicator)
{
_interactiveWindow = interactiveWindow;
_sendToInteractiveSubmissionProvider = new CSharpSendToInteractiveSubmissionProvider();
_sendToInteractiveSubmissionProvider = sendToInteractiveSubmissionProvider;
}
protected override ISendToInteractiveSubmissionProvider SendToInteractiveSubmissionProvider => _sendToInteractiveSubmissionProvider;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册