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

Avoid constructing CSharpSendToInteractiveSubmissionProvider outside the MEF catalog

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